158822025-03-07 12:46:54HolloGPlagiarism Detectioncpp17Wrong answer 0/100185ms2724 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

struct note {
    int d;
    int p;

    //auto operator == (note x, note y){return (x.d == y.d) && (x.p == y.p);}
};


vector<note> g, a;

bool trans (int x, int y){
    int dt; bool dg; bool r = true;
    if (g[x].d > a[x].d) {dt = g[x].d/a[x].d; dg = true;}
    else {dt = a[x].d/g[x].d; dg = false;}
    int pt = g[x].p - a[x].p;

    //cout << pt << " " << dt << endl;

    for (int i = x; i <= y; i++){
        if (g[i].p - a[i].p != pt) r = false;
        if (dt == 2)
        {
            if (dg){
                if (a[i].d * dt != g[i].d) r = false;
            }
            else {
                if (g[i].d * dt != a[i].d) r = false;
            }
        }
    }
    if (r == true) return r;
    r = true;

    if (g[x].d > a[y].d) {dt = g[x].d/a[y].d; dg = true;}
    else {dt = a[y].d/g[x].d; dg = false;}
    pt = g[x].p - a[y].p;

    //cout << pt << " " << dt << " " << dg << endl;


    for (int i = x; i <= y; i++){
        if (g[i].p - a[y-i+1].p != pt) r = false;
        if (dt == 2)
        {
            if (dg){
                if (a[y-i+1].d * dt != g[i].d) r = false;
            }
            else {
                if (g[i].d * dt != a[y-i+1].d) r = false;
            }
        }
    }
    return r;

}

int main() {
	int n, v; cin >> n >> v;

    
    for (int i = 0; i < n; i++){
        int d, p; cin >> d >> p;
        g.push_back({d, p});
    }
    for (int i = 0; i < n; i++){
        int d, p; cin >> d >> p;
        a.push_back({d, p});
    }

    int y = -1;
    int x = -1;

    for (int i = 0; i < n; i++){
        if (g[i].p != a[i].p || g[i].d != a[i].d){
            x = i;
            break;
        };
    }

    if (x == -1){
        cout << "SAME";
        return 0;
    }



    for (int i = n-1; i >= 0; i--){
        if (g[i].p != a[i].p || g[i].d != a[i].d){
            y = i;
            break;
        };
    }

    //cout << x << " " << y << endl;

    if (trans(x, y)){
        cout << "TRANSFORMED " << y-x+1;
    }
    else {
        cout << "ORIGINAL " << y-x+1;
    }



    return 0;

}




SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms316 KiB
2Accepted1ms508 KiB
3Accepted1ms316 KiB
subtask20/20
4Wrong answer1ms316 KiB
5Accepted2ms316 KiB
6Accepted1ms316 KiB
7Wrong answer1ms316 KiB
8Accepted1ms316 KiB
9Accepted1ms408 KiB
10Wrong answer1ms500 KiB
11Wrong answer1ms316 KiB
subtask30/15
12Accepted2ms500 KiB
13Wrong answer1ms316 KiB
14Accepted2ms316 KiB
15Accepted2ms316 KiB
16Accepted2ms316 KiB
17Accepted2ms316 KiB
18Accepted2ms316 KiB
19Accepted1ms316 KiB
subtask40/25
20Accepted10ms428 KiB
21Accepted8ms564 KiB
22Accepted10ms504 KiB
23Accepted6ms412 KiB
24Wrong answer8ms348 KiB
25Wrong answer4ms316 KiB
26Wrong answer1ms316 KiB
27Wrong answer6ms340 KiB
subtask50/10
28Accepted105ms2508 KiB
29Accepted57ms1492 KiB
30Accepted115ms2468 KiB
31Accepted104ms2612 KiB
32Wrong answer1ms316 KiB
33Accepted115ms2508 KiB
34Accepted86ms2312 KiB
35Accepted93ms2472 KiB
subtask60/30
36Wrong answer114ms1452 KiB
37Accepted52ms900 KiB
38Accepted156ms2468 KiB
39Accepted144ms2468 KiB
40Accepted185ms2724 KiB
41Accepted81ms1328 KiB
42Wrong answer1ms316 KiB
43Accepted172ms2616 KiB