158792025-03-07 12:31:50HolloGPlagiarism Detectioncpp17Wrong answer 0/100185ms2696 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;
        }
    }
    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
1Accepted1ms500 KiB
2Accepted1ms316 KiB
3Accepted1ms316 KiB
subtask20/20
4Wrong answer1ms404 KiB
5Accepted1ms316 KiB
6Accepted1ms316 KiB
7Wrong answer1ms316 KiB
8Accepted1ms316 KiB
9Accepted1ms316 KiB
10Wrong answer1ms316 KiB
11Wrong answer1ms316 KiB
subtask30/15
12Accepted2ms316 KiB
13Wrong answer1ms500 KiB
14Accepted2ms316 KiB
15Accepted2ms316 KiB
16Accepted2ms316 KiB
17Accepted2ms316 KiB
18Accepted2ms316 KiB
19Accepted1ms316 KiB
subtask40/25
20Accepted10ms564 KiB
21Accepted8ms564 KiB
22Accepted10ms564 KiB
23Accepted6ms316 KiB
24Wrong answer8ms572 KiB
25Wrong answer6ms316 KiB
26Wrong answer1ms316 KiB
27Wrong answer7ms316 KiB
subtask50/10
28Accepted105ms2472 KiB
29Accepted57ms1452 KiB
30Accepted115ms2696 KiB
31Accepted104ms2448 KiB
32Wrong answer1ms316 KiB
33Accepted115ms2468 KiB
34Accepted85ms2472 KiB
35Accepted93ms2404 KiB
subtask60/30
36Wrong answer115ms1552 KiB
37Accepted54ms944 KiB
38Accepted156ms2472 KiB
39Accepted144ms2536 KiB
40Accepted185ms2472 KiB
41Accepted81ms1448 KiB
42Wrong answer1ms316 KiB
43Accepted167ms2460 KiB