QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#416260 | #8357. 自动机 | Crysfly | 100 ✓ | 1ms | 3616kb | C++17 | 1.3kb | 2024-05-21 18:27:44 | 2024-05-21 18:27:45 |
Judging History
answer
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define int long long
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 600005
#define inf 0x3f3f3f3f
vi F;
vector<pii>res[2];
void add(int u,int v,int w){
res[w].pb(mkp(u,v));
}
void work6(){
F={0,1,2,3,4,5};
add(0,1,0),add(0,1,1);
add(1,0,1);
add(1,2,0);
add(2,3,0);
add(3,4,0);
add(4,5,0);
add(5,1,0);
add(3,3,1);
add(4,4,1);
add(5,5,1);
For(i,3,5) add(0,i,1),add(0,i,0);
}
void cir(int l,int r){
add(0,l,0),add(0,l,1);
For(i,l,r-1){
F.pb(i);
add(i,i+1,0),add(i,i+1,1);
}
add(r,l,1),add(r,l,0);
}
void work(){
F.pb(0);
cir(1,3);
cir(4,7);
cir(8,12);
cir(13,19);
}
signed main()
{
int n=read();
if(n==6)work6();
else work();
For(c,0,1){
cout<<res[c].size()<<"\n";
for(auto it:res[c])cout<<it.fi<<" "<<it.se<<"\n";
}
cout<<F.size()<<"\n";
for(int x:F)cout<<x<<' ';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 50
Accepted
time: 1ms
memory: 3472kb
input:
6
output:
9 0 1 1 2 2 3 3 4 4 5 5 1 0 3 0 4 0 5 8 0 1 1 0 3 3 4 4 5 5 0 3 0 4 0 5 6 0 1 2 3 4 5
result:
ok l = 21
Test #2:
score: 50
Accepted
time: 1ms
memory: 3616kb
input:
20
output:
23 0 1 1 2 2 3 3 1 0 4 4 5 5 6 6 7 7 4 0 8 8 9 9 10 10 11 11 12 12 8 0 13 13 14 14 15 15 16 16 17 17 18 18 19 19 13 23 0 1 1 2 2 3 3 1 0 4 4 5 5 6 6 7 7 4 0 8 8 9 9 10 10 11 11 12 12 8 0 13 13 14 14 15 15 16 16 17 17 18 18 19 19 13 16 0 1 2 4 5 6 8 9 10 11 13 14 15 16 17 18
result:
ok l = 420