Submission #850951

#TimeUsernameProblemLanguageResultExecution timeMemory
850951CyanmondPick (COI18_pick)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i, l, r) for (int i = (l); i < (r); ++i) #define per(i, l, r) for (int i = (r - 1); i >= l; --i) #define ALL(x) (x).begin(), (x).end() using i64 = long long; void main_() { i64 A, B, C, D; cin >> A >> B >> C >> D; vector<pair<int, int>> ans; rep(a1, 0, A + 1) { i64 a2 = A - a1; rep(b1, 0, B + 1) { i64 b2 = B - b1; rep(c1, 0, C + 1) { i64 c2 = C - c1; i64 xsum = a1 - a2 + c1 - c2; i64 ysum = b1 - b2 + c1 - c2; if (xsum + ysum != 0) continue; rep(d1, 0, D + 1) { i64 d2 = D - d1; xsum += d1 - d2; ysum += d2 - d1; if (xsum != 0 or ysum != 0) continue; // loop : O(n^2) int x = 0, y = 0; vector<pair<int, int>> res; auto moveD = [&](int ax, int ay) { res.push_back({x, y}); x += ax, y += ay; }; rep(i, 0, a1) moveD(1, 0); rep(i, 0, d1) moveD(1, -1); rep(i, 0, b2) moveD(0, -1); rep(i, 0, c2) moveD(-1, -1); rep(i, 0, a2) moveD(1, -1); rep(i, 0, d2) moveD(-1, 1); rep(i, 0, b1) moveD(0, 1); rep(i, 0, c1) moveD(1, 1); ans = move(res); } } } } for (const auto &[x, y] : ans) { cout << x << ' ' << y << endl; } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); main_(); }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...