# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
677896 | 2023-01-04T14:49:42 Z | qwerasdfzxcl | Remittance (JOI19_remittance) | C++17 | 1 ms | 468 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; bool visited[300300]; int n; int v_to_i(vector<int> v){ int pw = 1, ret = 0; for (int i=0;i<n;i++){ ret += pw * v[i]; pw *= n; } return ret; } vector<int> i_to_v(int x){ vector<int> ret; for (int i=0;i<n;i++){ ret.push_back(x%n); x /= n; } return ret; } void dfs(int s){ visited[s] = 1; auto a = i_to_v(s); for (int i=0;i<n;i++){ for (int j=1;j*2<=a[i];j++){ auto na = a; na[i] -= j*2; na[(i+1)%n] += j; int v = v_to_i(na); if (!visited[v]) dfs(v); } } } int main(){ scanf("%d", &n); vector<int> a, b; for (int i=0;i<n;i++){ int x, y; scanf("%d %d", &x, &y); a.push_back(x); b.push_back(y); } dfs(v_to_i(a)); if (visited[v_to_i(b)]) printf("Yes\n"); else printf("No\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |