Submission #232321

#TimeUsernameProblemLanguageResultExecution timeMemory
232321pedy4000Trapezi (COI17_trapezi)C++14
0 / 100
5 ms384 KiB
#include <algorithm> #include <iostream> #include <vector> using namespace std; typedef long long ll; typedef pair <int, int> pii; const int N = 1e3 + 3; int n, m; string s[N]; pii nxt (pii p) { if (p.first == 0) { if (p.second == 2) return pii(1, 2); return pii(p.first, p.second + 1); } if (p.second == 0) return pii(0, 0); return pii(p.first, p.second - 1); } char get (pii p) { return s[p.first][p.second]; } void upd (pii p) { s[p.first][p.second] = '1'; } int main() { ios::sync_with_stdio(false), cin.tie(0); cin >> n; if (n == 1) { cin >> s[0] >> s[1]; int num = 0; for (int i = 0; i < 2; i++) for (int j = 0; j < 3; j++) num += s[i][j] == '0'; if (num % 3) { cout << "nemoguce\n"; return 0; } if (num == 0) { cout << s[0] << " " << s[1] << "\n"; return 0; } for (int i = 0; i < 2; i++) for (int j = 0; j < 3; j++) { if (s[i][j] == '0' && get(nxt(pii(i, j))) == '0' && get(nxt(nxt(pii(i, j)))) == '0') { s[i][j] = '1'; upd(nxt(pii(i, j))); upd(nxt(nxt(pii(i, j)))); cout << s[0] << "\n" << s[1] << "\n"; return 0; } } cout << "nemoguce\n"; return 0; } return 0; }
#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...