# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
773686 | 2023-07-05T07:47:34 Z | gagik_2007 | Remittance (JOI19_remittance) | C++17 | 25 ms | 4052 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define ff first #define ss second ll ttt; const ll INF=1e18; const ll MOD=1e9+7; const ll N=105413504+7; ll n,m,k; vector<int>a,b; bool used[N]; int verjval; const int MAXVAL=14; int value(const vector<int>& p){ int cur=1; int res=0; for(int x:p){ res+=cur*x; cur*=MAXVAL; } return res; } vector<int> deval(int val){ vector<int>ans; while(val!=0){ ans.push_back(val%MAXVAL); val/=MAXVAL; } return ans; } void recurs(int val){ if(val==verjval){ cout<<"Yes"<<endl; exit(0); } if(used[val])return; used[val]=true; vector<int>p=deval(val); for(int i=0;i<p.size();i++){ for(int j=0;j<p.size();j++){ if(i!=j){ int t1=p[i]; int t2=p[j]; for(int vl=1;vl<=p[i]/2;vl++){ p[i]-=2*vl; p[j]+=vl; recurs(value(p)); p[i]=t1; p[j]=t2; } } } } } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); freopen("output.txt","w",stdout); cin>>n; for(int i=0;i<n;i++){ int x,y; cin>>x>>y; a.push_back(x); b.push_back(y); } verjval=value(b); recurs(value(a)); cout<<"No"<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 4052 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 4052 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 4052 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |