Submission #413717

#TimeUsernameProblemLanguageResultExecution timeMemory
413717rabbitsthecatRemittance (JOI19_remittance)C++17
0 / 100
1083 ms26332 KiB
#include "bits/stdc++.h" using namespace std; #define ffor(n) for(int i = 0; i < n; i++) #define fffor(n) for(int j = 0; j < n; j++) #define uwu ios::sync_with_stdio(false);cin.tie(NULL); #pragma GCC optimize("Ofast") const int INF = 1e9 + 7; const long long INF2 = 1e17; int main(void) { uwu auto print = [] (vector <int>& v) { for(int x: v) cout << x << ' '; cout << '\n'; }; int n; cin >> n; vector <int> left(n), right(n); ffor(n) cin >> left[i] >> right[i]; map <vector <int>, bool> reachable; vector <int> v = left; auto bfs = [&] (auto&& bfs) -> void { if (reachable[v]) return; reachable[v] = true; for(int i = 0; i < n; i++) { for(int delta = 2; delta <= v[i]; delta += 2) { v[i] -= delta; v[(i + 1) % n] += (delta / 2); bfs(bfs); v[(i + 1) % n] -= (delta / 2); v[(i + n - 1) % n] += (delta / 2); bfs(bfs); v[(i + n - 1) % n] -= (delta / 2); v[i] += delta; } } }; bfs(bfs); if (reachable[right]) cout << "Yes\n"; else cout << "No\n"; } /* C:\Users\kenne\OneDrive\Desktop\competitive_programming\main.cpp */

Compilation message (stderr)

remittance.cpp: In function 'int main()':
remittance.cpp:15:7: warning: variable 'print' set but not used [-Wunused-but-set-variable]
   15 |  auto print = [] (vector <int>& v) {
      |       ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...