QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#559380 | #6537. One, Two, Three | Meatherm | WA | 0ms | 4112kb | C++14 | 2.6kb | 2024-09-11 21:46:47 | 2024-09-11 21:46:48 |
Judging History
answer
# include <bits/stdc++.h>
# define ep emplace_back
# define pb pop_back
# define sz(x) x.size()
# define v(y,x) std::get<(x)>(y)
const int N=600010,INF=0x3f3f3f3f;
inline int read(void){
int res,f=1;
char c;
while((c=getchar())<'0'||c>'9')
if(c=='-')f=-1;
res=c-48;
while((c=getchar())>='0'&&c<='9')
res=res*10+c-48;
return res*f;
}
int main(void){
std::vector <std::tuple <int> > v0,v2;
std::vector <std::tuple <int,int> > v01,v21;
std::vector <std::tuple <int,int,int> > v012,v210,v021;
std::vector <std::tuple <int,int,int,int> > v0121,v2101;
int n=read();
for(int i=0;i<n;++i){
int x=read()-1;
if(x==0){
if(sz(v21)){
auto c=v21.back();
v210.emplace_back(v(c,0),v(c,1),i);
v21.pb();
}else if(sz(v021)){
auto c=v021.back();
v210.ep(v(c,1),v(c,2),i);
v0.ep(v(c,0));
v021.pb();
}else if(sz(v0121)){
auto c=v0121.back();
v210.ep(v(c,2),v(c,3),i);
v01.ep(v(c,0),v(c,1));
v0121.pb();
}else if(sz(v2101)){
auto c=v2101.back();
v210.ep(v(c,0),v(c,1),i);
v01.ep(v(c,2),v(c,3));
v2101.pb();
}else v0.ep(i);
}else if(x==1){
if(sz(v0)&&sz(v2)){
auto c0=v0.back(),c2=v2.back();
v021.ep(v(c0,0),v(c2,0),i);
v0.pb(),v2.pb();
}else if(sz(v0)){
auto c=v0.back();
v01.ep(v(c,0),i);
v0.pb();
}else if(sz(v2)){
auto c=v2.back();
v21.ep(v(c,0),i);
v2.pb();
}else if(sz(v021)){
auto c=v021.back();
v01.ep(v(c,0),v(c,2));
v21.ep(v(c,1),i);
v021.pb();
}else if(sz(v012)){
auto c=v012.back();
v0121.ep(v(c,0),v(c,1),v(c,2),i);
v012.pb();
}else if(sz(v210)){
auto c=v210.back();
v2101.ep(v(c,0),v(c,1),v(c,2),i);
v210.ep();
}
}else{
if(sz(v01)){
auto c=v01.back();
v012.emplace_back(v(c,0),v(c,1),i);
v01.pb();
}else if(sz(v021)){
auto c=v021.back();
v012.ep(v(c,0),v(c,2),i);
v2.ep(v(c,1));
v021.pb();
}else if(sz(v2101)){
auto c=v2101.back();
v012.ep(v(c,2),v(c,3),i);
v21.ep(v(c,0),v(c,1));
v2101.pb();
}else if(sz(v0121)){
auto c=v0121.back();
v012.ep(v(c,0),v(c,1),i);
v21.ep(v(c,2),v(c,3));
v0121.pb();
}else v2.ep(i);
}
}
printf("%d\n",(int)(v012.size()+v210.size()+v0121.size()+v2101.size()));
for(auto w:v012) printf("%d %d %d\n",v(w,0),v(w,1),v(w,2));
for(auto w:v210) printf("%d %d %d\n",v(w,0),v(w,1),v(w,2));
for(auto w:v0121) printf("%d %d %d\n",v(w,0),v(w,1),v(w,2));
for(auto w:v2101) printf("%d %d %d\n",v(w,0),v(w,1),v(w,2));
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3736kb
input:
6 3 1 2 2 3 1
output:
2 1 2 4 0 3 5
result:
ok count=2
Test #2:
score: 0
Accepted
time: 0ms
memory: 4112kb
input:
6 2 1 3 1 3 2
output:
0
result:
ok count=0
Test #3:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
3000 1 1 1 1 1 3 1 1 3 3 1 3 1 1 2 3 1 1 2 1 2 1 3 3 3 1 1 2 1 2 2 3 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 3 3 1 1 2 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 2 3 1 1 1 1 3 3 2 1 3 1 1 2 3 1 2 3 1 1 1 2 1 1 1 1 2 3 2 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 3 1 3 3 1 1 1 1 3 1 1 2 1 1 1 3 3 1 1 1 1 2 1 1 1 1 1 2 3 3 1...
output:
499 13 14 15 25 30 31 45 46 47 70 71 72 66 67 77 83 84 85 86 87 88 96 97 98 112 113 117 104 105 119 95 99 120 143 144 145 210 215 217 243 244 245 257 258 259 275 276 277 273 284 288 295 296 298 297 299 304 290 291 305 309 312 313 308 314 317 321 322 325 316 318 326 310 311 328 331 332 333 330 334 33...
result:
ok count=499
Test #4:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
3000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
1 1932 1933 2901
result:
ok count=1
Test #5:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
3000 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
1 1755 1756 2819
result:
ok count=1
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 4056kb
input:
1500 1 1 1 2 1 1 1 2 2 2 2 2 1 1 3 1 2 2 3 1 2 2 2 2 1 2 1 2 1 1 3 1 2 2 2 2 1 1 3 1 1 2 2 3 2 1 3 1 1 2 2 2 1 2 2 2 2 2 1 2 3 2 3 2 3 2 1 3 2 1 2 3 2 2 3 2 3 1 1 3 1 3 1 3 3 3 1 3 3 3 1 1 3 1 3 1 3 1 1 1 3 1 3 1 3 3 1 1 1 3 1 1 3 1 1 1 1 1 3 3 3 3 1 3 1 1 1 1 3 3 3 3 3 3 1 3 1 1 1 3 1 3 1 1 1 1 3 1...
output:
526 29 34 76 48 49 79 40 41 81 0 57 83 0 35 84 24 25 85 0 73 87 31 32 88 26 27 89 58 59 92 0 56 94 0 55 96 47 51 100 52 53 102 0 54 104 69 70 105 13 17 109 0 11 112 12 21 118 19 20 119 15 16 120 1 10 121 4 9 123 5 8 128 6 7 129 2 3 130 363 364 365 449 450 451 551 598 599 549 600 601 552 597 602 561 ...
result:
wrong answer the number of matches is different