Submission #1069770

#TimeUsernameProblemLanguageResultExecution timeMemory
1069770AbitoBring Down the Grading Server (CEOI23_gradingserver)C++17
5 / 100
979 ms150352 KiB
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define ppb pop_back #define ep insert #define endl '\n' #define elif else if #define pow pwr #define sqrt sqrtt #define int long long #define ll long long typedef unsigned long long ull; using namespace std; const int N=80; int s; bool vis[N][N][N][N][2],dp[N][N][N][N][2]; bool rec(int i,int j,int k,int l,bool h){ if (i<=0) return h; if (k<=0) return !h; if (vis[i][j][k][l][h]) return dp[i][j][k][l][h]; vis[i][j][k][l][h]=1; if (!h){ if (l) dp[i][j][k][l][h]|=!rec(i,j,k,l-1,1); if (i-s*l>0) dp[i][j][k][l][h]|=!rec(i,j,k-i+s*l,l,1); } else{ if (j) dp[i][j][k][l][h]|=!rec(i,j-1,k,l,0); if (k-s*j>0) dp[i][j][k][l][h]|=!rec(i-k+s*j,j,k,l,0); } return dp[i][j][k][l][h]; } int32_t main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int T;cin>>s>>T; while (T--){ int ch,fh,cg,fg; cin>>ch>>fh>>cg>>fg; if (rec(ch,fh,cg,fg,0)) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; }
#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...