158832025-03-07 13:09:14HolloGPlagiarism Detectioncpp17Wrong answer 0/100175ms2568 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 (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 (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;
        }
    }

    if(r == true) return r;
    r = true;

    for (int i = x; i <= y; i++){
        if (g[i].p != a[y-i].p || g[i].d != a[y-i].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
2Accepted1ms316 KiB
3Accepted1ms508 KiB
subtask20/20
4Wrong answer1ms316 KiB
5Accepted1ms316 KiB
6Accepted1ms316 KiB
7Wrong answer1ms316 KiB
8Accepted1ms316 KiB
9Accepted1ms316 KiB
10Wrong answer1ms384 KiB
11Wrong answer1ms316 KiB
subtask30/15
12Accepted1ms408 KiB
13Wrong answer1ms340 KiB
14Accepted2ms316 KiB
15Accepted1ms316 KiB
16Accepted1ms316 KiB
17Accepted1ms316 KiB
18Accepted2ms316 KiB
19Accepted1ms316 KiB
subtask40/25
20Accepted9ms760 KiB
21Accepted8ms620 KiB
22Accepted9ms564 KiB
23Accepted6ms496 KiB
24Wrong answer8ms564 KiB
25Wrong answer4ms336 KiB
26Wrong answer1ms316 KiB
27Wrong answer6ms700 KiB
subtask50/10
28Accepted98ms2444 KiB
29Accepted52ms1452 KiB
30Accepted108ms2472 KiB
31Accepted97ms2476 KiB
32Wrong answer1ms316 KiB
33Accepted107ms2568 KiB
34Accepted81ms2468 KiB
35Accepted86ms2524 KiB
subtask60/30
36Wrong answer108ms1440 KiB
37Accepted50ms944 KiB
38Accepted149ms2456 KiB
39Accepted137ms2456 KiB
40Accepted175ms2472 KiB
41Accepted76ms1464 KiB
42Wrong answer1ms316 KiB
43Accepted159ms2468 KiB