158882025-03-07 13:44:18HolloGPlagiarism Detectioncpp17Accepted 100/100185ms2516 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){
    double dt; bool dg; bool r = true;
    if (g[x].d > a[x].d) {dt = (double)g[x].d/(double)a[x].d; dg = true;}
    else {dt = (double)a[x].d/(double)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;
        }
        }
        else if(dt != 1) r = false;
    }
    if (r == true)  return r;
    r = true;

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

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


    for (int i = x; i <= y; i++){
        //cout << g[i].p << " " << a[y-i+x].p << "\n";
        if (g[i].p - a[y-i+x].p != pt) r = false;
        if (dt == 2) {
        if (dg){
            if (a[y-i+x].d * dt != g[i].d) r = false;
        }
        else {
            if (g[i].d * dt != a[y-i+x].d) r = false;
        }
        }
        else if(dt != 1) 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
3Accepted1ms316 KiB
subtask220/20
4Accepted1ms316 KiB
5Accepted1ms316 KiB
6Accepted1ms316 KiB
7Accepted1ms500 KiB
8Accepted1ms316 KiB
9Accepted1ms316 KiB
10Accepted2ms316 KiB
11Accepted1ms328 KiB
subtask315/15
12Accepted1ms316 KiB
13Accepted1ms316 KiB
14Accepted2ms316 KiB
15Accepted2ms316 KiB
16Accepted1ms408 KiB
17Accepted2ms316 KiB
18Accepted2ms316 KiB
19Accepted1ms316 KiB
subtask425/25
20Accepted10ms564 KiB
21Accepted8ms564 KiB
22Accepted10ms564 KiB
23Accepted6ms316 KiB
24Accepted8ms524 KiB
25Accepted6ms508 KiB
26Accepted1ms508 KiB
27Accepted6ms316 KiB
subtask510/10
28Accepted105ms2464 KiB
29Accepted57ms1456 KiB
30Accepted115ms2472 KiB
31Accepted103ms2472 KiB
32Accepted1ms316 KiB
33Accepted115ms2516 KiB
34Accepted85ms2472 KiB
35Accepted93ms2472 KiB
subtask630/30
36Accepted114ms1556 KiB
37Accepted52ms944 KiB
38Accepted156ms2468 KiB
39Accepted144ms2472 KiB
40Accepted185ms2468 KiB
41Accepted82ms1452 KiB
42Accepted1ms316 KiB
43Accepted167ms2516 KiB