# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
773678 |
2023-07-05T07:45:08 Z |
vjudge1 |
Semafor (COI20_semafor) |
C++17 |
|
4000 ms |
1364 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
116 ms |
212 KB |
Output is correct |
5 |
Correct |
92 ms |
300 KB |
Output is correct |
6 |
Correct |
2950 ms |
300 KB |
Output is correct |
7 |
Correct |
8 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
296 ms |
296 KB |
Output is correct |
10 |
Correct |
102 ms |
300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
116 ms |
212 KB |
Output is correct |
5 |
Correct |
92 ms |
300 KB |
Output is correct |
6 |
Correct |
2950 ms |
300 KB |
Output is correct |
7 |
Correct |
8 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
296 ms |
296 KB |
Output is correct |
10 |
Correct |
102 ms |
300 KB |
Output is correct |
11 |
Execution timed out |
4070 ms |
1364 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |