Submission #773678

#TimeUsernameProblemLanguageResultExecution timeMemory
773678vjudge1Semafor (COI20_semafor)C++17
6 / 100
4070 ms1364 KiB
#include<bits/stdc++.h> using namespace std; #define lalala ios_base::sync_with_stdio(false);cin.tie(NULL); //#define endl "\n" #define ll long long #define N 200005 #define pb push_back int n,k; int arr[10]; void hmm(int a,int b,int c,int d,int e,int kac){ if(kac%k==0){ int yes=0; if(a+b+c+d+e==1&&b==1)yes++; if(a+d==2&&b+c+e==0)yes++; if(a+b+c==3&&d+e==0)yes++; if(b+e==2&&a+c+d==0)yes++; if(e+c+a==3&&b+d==0)yes++; if(c+d==2&&a+b+e==0)yes++; if(a+b==2&&c+d+e==0)yes++; if(a+c+d+e==4&&b==0)yes++; if(a+b+c+e==4&&d==0)yes++; if(d+b==2&&a+c+e==0)yes++; if(yes==0)return; } if(n==kac){ if(a+b+c+d+e==1&&b==1)arr[1]++; if(a+d==2&&b+c+e==0)arr[2]++; if(a+b+c==3&&d+e==0)arr[3]++; if(b+e==2&&a+c+d==0)arr[4]++; if(e+c+a==3&&b+d==0)arr[5]++; if(c+d==2&&a+b+e==0)arr[6]++; if(a+b==2&&c+d+e==0)arr[7]++; if(a+c+d+e==4&&b==0)arr[8]++; if(a+b+c+e==4&&d==0)arr[9]++; if(d+b==2&&a+c+e==0)arr[0]++; //cout<<a<<" b "<<b<<" "<<c<<" "<<d<<" "<<e<<"_"<<kac<<endl; //for(int i=0;i<10;i++)cout<<arr[i]<<" "; //cout<<endl; return; } //cout<<a<<" a "<<b<<" "<<c<<" "<<d<<" "<<e<<"_"<<kac<<endl; if(a) hmm(0,b,c,d,e,kac+1); else hmm(1,b,c,d,e,kac+1); if(b) hmm(a,0,c,d,e,kac+1); else hmm(a,1,c,d,e,kac+1); if(c) hmm(a,b,0,d,e,kac+1); else hmm(a,b,1,d,e,kac+1); if(d) hmm(a,b,c,0,e,kac+1); else hmm(a,b,c,1,e,kac+1); if(e) hmm(a,b,c,d,0,kac+1); else hmm(a,b,c,d,1,kac+1); } int main(){ lalala; int m,x; cin>>m>>n>>k>>x; int a=0,b=0,c=0,d=0,e=0; if(x==0) d=b=1; if(x==1) b=1; if(x==2) a=d=1; if(x==3) a=c=b=1; if(x==4) b=e=1; if(x==5) a=e=c=1; if(x==6) d=c=1; if(x==7) a=b=1; if(x==8) a=c=d=e=1; if(x==9) a=b=c=e=1; hmm(a,b,c,d,e,0); for(int i=0;i<10;i++)cout<<arr[i]<<endl; }
#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...