Submission #1266282

#TimeUsernameProblemLanguageResultExecution timeMemory
1266282DanielPr8Bring Down the Grading Server (CEOI23_gradingserver)C++20
0 / 100
4097 ms260272 KiB
#include <bits/stdc++.h> using namespace std; using ll = int; using vll = vector<ll>; using vvl = vector<vll>; using pll = pair<ll,ll>; using vpl = vector<pll>; using vvp = vector<vpl>; #define f first #define s second #define pb push_back #define all(v) v.begin(),v.end() map<pair<pll,pll>,ll> hs; ll s; ll calc(ll c1, ll f1, ll c2, ll f2){ if(c1==0)return 0; if(c2==0)return 1; if(hs.count({{c1,f1},{c2,f2}}))return hs[{{c1,f1},{c2,f2}}]; if(f2>0){ if(calc(c2,f2-1, c1,f1)==0)return hs[{{c1,f1},{c2,f2}}]=1; } if(c1>f2*s){ if(calc(max<ll>(0, c2-c1+f2*s), f2, c1, f1)==0)return hs[{{c1,f1},{c2,f2}}]=1; } return hs[{{c1,f1},{c2,f2}}]=0;; } int main(){ ios_base::sync_with_stdio(0);cin.tie(NULL); ll n; cin >> s >> n; while(n--){ ll a,b,c,d; cin >> a >> b >> c >> d; if(calc(a,b,c,d))cout << "YES\n"; else cout << "NO\n"; } }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...