답안 #418488

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
418488 2021-06-05T12:00:34 Z ACmachine Scissors and Tape (CEOI19_scissors) C++17
0 / 100
1000 ms 78504 KB
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k, l) for(int i = (j); i < (k); i += (l))
#define FORD(i, j, k, l) for(int i = (j); i >= (k); i -= (l))
#define REP(i, n) FOR(i, 0, n, 1)
#define REPD(i, n) FORD(i, n, 0, 1)
#define pb push_back
#define ff first
#define ss second
typedef long long ll;
const ll INFF = (ll)1e18;
const int INF = (int)1e9;
int main(){
    int n, m;
    cin >> n;
    vector<array<int, 2>> f, s;
    REP(i, n){
        int x, y;
        cin >> x >> y;
        f.pb({x, y});
    }
    cin >> m;
    REP(i, m){
        int x ,y;
        cin >> x >> y;
        s.pb({x, y});
    }
    int x = s[2][0];
    int y = s[2][1];  
    array<int, 2> pt;
    if(f[1][0] == s[1][0]) 
        return 0;
    if(f[1][0] > x){
        pt = f[3];
    }
    else{
        pt = f[1];
    }
    array<int, 2> res = s[2];
    int id = 0;
    auto p = [&](array<int, 2> a){
        cout << a[0] << " " << a[1] << " ";
    };
    while(pt != res){
        if(f[1][0] > x){
            cout << "scissors\n";
            cout << id << " 2\n";
            cout << 4 << " ";
            p(f[0]); 
            p({x, f[1][1]}); 
            p({x, f[2][1]});
            p(f[3]);
            cout << "\n4 ";
            p({x, f[0][1]});
            p(f[1]);
            p(f[2]);
            p({x, f[3][1]});
            cout << "\n";
            vector<array<int, 2>> nf = {{x, f[0][1]}, f[1], f[2], {x, f[3][1]}};
            f = nf; 
            id += 2;
            cout << "tape\n";
            cout << 1 << " " << id << "\n";
            REPD(i, 3){
                f[i][0] -= f[0][0];
                f[i][1] -= f[0][1];
            }
            REPD(i, 3){
                f[i][0] += pt[0];
                f[i][1] += pt[1];
            }
            REP(i, 4){
                p(f[i]);
            }
            cout << "\n";
            REP(i, 4){
                p(f[i]);
            }
            id++;
            cout << "\n";
            if(f[1][0] == x){
                pt = res;
            }
            if(f[1][0] > x){
                pt = f[3];
            }
            else{
                pt = f[1];
            }
        }
        else{
            cout << "scissors\n";
            cout << id << " 2\n";
            cout << 4 << " ";
            p(f[0]); 
            p(f[1]); 
            p({f[2][0], y});
            p({f[3][0], y});
            cout << "\n4 ";
            p({f[0][0], y});
            p({f[1][0], y});
            p(f[2]);
            p(f[3]);
            cout << "\n";
            vector<array<int, 2>> nf = {{f[0][0], y}, {f[1][0], y}, f[2], f[3]};
            f = nf; 
            id += 2;
            cout << "tape\n";
            cout << 1 << " " << id << "\n";
            REPD(i, 3){
                f[i][0] -= f[0][0];
                f[i][1] -= f[0][1];
            }
            REPD(i, 3){
                f[i][0] += pt[0];
                f[i][1] += pt[1];
            }
            REP(i, 4){
                p(f[i]);
            }
            cout << "\n";
            REP(i, 4){
                p(f[i]);
            }
            id++;
            cout << "\n";
            if(f[1][0] == x){
                pt = res;
            }
            if(f[1][0] > x){
                pt = f[3];
            }
            else{
                pt = f[1];
            }
        }
    
    }
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1088 ms 30732 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1086 ms 68664 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1088 ms 30732 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1083 ms 73532 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1057 ms 78504 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1088 ms 30732 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1088 ms 30732 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1088 ms 30732 KB Time limit exceeded
2 Halted 0 ms 0 KB -