158842025-03-07 13:17:08HolloGPlagiarism Detectioncpp17Wrong answer 0/100202ms3108 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++){
        cout << g[i].p << " " << a[y-i+x].p << "\n";
        if (g[i].p - a[y-i+x].p != pt) r = false;
        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;
        }
    }

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

    for (int i = x; i <= y; i++){
        if (g[i].p != a[y-i+x].p || g[i].d != a[y-i+x].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
1Accepted1ms508 KiB
2Wrong answer1ms508 KiB
3Wrong answer1ms316 KiB
subtask20/20
4Wrong answer1ms316 KiB
5Accepted1ms360 KiB
6Wrong answer1ms316 KiB
7Wrong answer1ms316 KiB
8Wrong answer1ms316 KiB
9Accepted1ms316 KiB
10Wrong answer1ms376 KiB
11Wrong answer1ms316 KiB
subtask30/15
12Wrong answer2ms316 KiB
13Wrong answer1ms316 KiB
14Accepted2ms316 KiB
15Wrong answer2ms316 KiB
16Wrong answer1ms316 KiB
17Wrong answer2ms316 KiB
18Wrong answer2ms316 KiB
19Accepted1ms316 KiB
subtask40/25
20Accepted10ms568 KiB
21Accepted8ms564 KiB
22Wrong answer12ms564 KiB
23Accepted6ms316 KiB
24Wrong answer8ms576 KiB
25Wrong answer6ms508 KiB
26Wrong answer1ms316 KiB
27Wrong answer7ms456 KiB
subtask50/10
28Wrong answer108ms2596 KiB
29Wrong answer61ms1452 KiB
30Accepted114ms2472 KiB
31Accepted104ms2568 KiB
32Wrong answer1ms316 KiB
33Wrong answer119ms2508 KiB
34Accepted83ms2520 KiB
35Accepted92ms2504 KiB
subtask60/30
36Wrong answer122ms2092 KiB
37Wrong answer57ms1072 KiB
38Wrong answer163ms2568 KiB
39Accepted144ms2472 KiB
40Wrong answer202ms3108 KiB
41Wrong answer82ms1516 KiB
42Wrong answer1ms316 KiB
43Accepted172ms2556 KiB