제출 #301586

#제출 시각아이디문제언어결과실행 시간메모리
301586kevinsogoHandcrafted Gift (IOI20_gift)C++17
15 / 100
191 ms17016 KiB
#include "gift.h" #include <bits/stdc++.h> using namespace std; int construct(int n, int r, vector<int> a, vector<int> b, vector<int> x) { vector<int> same(n); for (int i = 0; i < r; i++) { if (x[i] == 1) { same[a[i]]++; same[b[i]]--; } } for (int i = 0; i < n - 1; i++) same[i + 1] += same[i]; assert(same.back() == 0); vector<int> diff(n); for (int i = 0; i < n - 1; i++) diff[i + 1] = diff[i] + !same[i]; for (int i = 0; i < r; i++) { if (x[i] == 1) assert(diff[a[i]] == diff[b[i]]); if (x[i] == 2 && diff[a[i]] == diff[b[i]]) return 0; } string s(n, 'R'); for (int i = 0; i < n - 1; i++) { if (!same[i]) s[i + 1] = s[i] ^ 'R' ^ 'B'; } craft(s); return 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...