Submission #418502

#TimeUsernameProblemLanguageResultExecution timeMemory
418502ACmachineScissors and Tape (CEOI19_scissors)C++17
0 / 100
1 ms204 KiB
#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){ //cout << "P :" << pt[0] << " " << pt[1] << endl; 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]; } cout << 4 << " "; REP(i, 4){ p(f[i]); } cout << "\n4 "; REP(i, 4){ p(f[i]); } id++; cout << "\n"; if(f[1][0] == x){ break; 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]; } cout << "4 "; REP(i, 4){ p(f[i]); } cout << "\n4 "; REP(i, 4){ p(f[i]); } id++; cout << "\n"; if(f[1][0] == x){ break; pt = res; } if(f[1][0] > x){ pt = f[3]; } else{ pt = f[1]; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...