QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#190031 | #6319. Parallel Processing (Easy) | 275307894a | AC ✓ | 1ms | 3932kb | C++14 | 2.2kb | 2023-09-28 08:24:02 | 2023-09-28 08:24:04 |
Judging History
answer
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;using LL=__int128;
const int N=2e5+5,M=N*100+5,K=600+5,mod=1e9+7,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(263082);
int n;
vector<tuple<int,int,int> > ans;
void Do(int x,int y,int z){ans.emplace_back(x,y,z);}
void Solve(){
int i,j;scanf("%d",&n);
int m=1;
while(m+13<=n){
for(i=m;i<m+3;i++) {
for(j=i;j<m+15;j+=4) Do(j+1,j,j+1);
}
for(i=m+3;i<m+15;i+=4) for(j=i+1;j<=i+4;j++) Do(j,i,j);
m+=15;
}
if(m>=n){
}else if(m+1>=n){
Do(m+1,m,m+1);Do(2000,2000,2000);Do(2000,2000,2000);Do(2000,2000,2000);
}else if(m+3>=n){
Do(m+1,m,m+1);Do(m+3,m+2,m+3);Do(2000,2000,2000);Do(2000,2000,2000);
Do(m+2,m+1,m+2);Do(m+3,m+1,m+3);Do(2000,2000,2000);Do(2000,2000,2000);
}else if(m+7>=n){
Do(m+1,m,m+1);Do(m+3,m+2,m+3);Do(m+5,m+4,m+5);Do(m+7,m+6,m+7);
Do(m+2,m+1,m+2);Do(m+3,m+1,m+3);Do(m+6,m+5,m+6);Do(m+7,m+5,m+7);
Do(m+4,m+3,m+4);Do(m+5,m+3,m+5);Do(m+6,m+3,m+6);Do(m+7,m+3,m+7);
}else if(m+10>=n){
Do(m+1,m,m+1);Do(m+3,m+2,m+3);Do(m+5,m+4,m+5);Do(m+8,m+7,m+8);
Do(m+2,m+1,m+2);Do(m+3,m+1,m+3);Do(m+6,m+5,m+6);Do(m+9,m+8,m+9);
Do(m+4,m+3,m+4);Do(m+5,m+3,m+5);Do(m+6,m+3,m+6);Do(m+10,m+9,m+10);
Do(m+7,m+6,m+7);Do(m+8,m+6,m+8);Do(m+9,m+6,m+9);Do(m+10,m+6,m+10);
}else if(m+12>=n){
Do(m+1,m,m+1);Do(m+4,m+3,m+4);Do(m+7,m+6,m+7);Do(m+10,m+9,m+10);
Do(m+2,m+1,m+2);Do(m+5,m+4,m+5);Do(m+8,m+7,m+8);Do(m+11,m+10,m+11);
Do(m+3,m+2,m+3);Do(m+4,m+2,m+4);Do(m+5,m+2,m+5);Do(m+12,m+11,m+12);
Do(m+6,m+5,m+6);Do(m+7,m+5,m+7);Do(m+8,m+5,m+8);Do(2000,2000,2000);
Do(m+9,m+8,m+9);Do(m+10,m+8,m+10);Do(m+11,m+8,m+11);Do(m+12,m+8,m+12);
}
printf("%d\n",ans.size()/4);
for(auto i:ans){
int x,y,z;tie(x,y,z)=i;
printf("%d %d %d\n",x,y,z);
}
}
int main(){
int t=1;
// scanf("%d",&t);
while(t--) Solve();
cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3824kb
input:
2
output:
1 2 1 2 2000 2000 2000 2000 2000 2000 2000 2000 2000
result:
ok AC
Test #2:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
4
output:
2 2 1 2 4 3 4 2000 2000 2000 2000 2000 2000 3 2 3 4 2 4 2000 2000 2000 2000 2000 2000
result:
ok AC
Test #3:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
3
output:
2 2 1 2 4 3 4 2000 2000 2000 2000 2000 2000 3 2 3 4 2 4 2000 2000 2000 2000 2000 2000
result:
ok AC
Test #4:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
5
output:
3 2 1 2 4 3 4 6 5 6 8 7 8 3 2 3 4 2 4 7 6 7 8 6 8 5 4 5 6 4 6 7 4 7 8 4 8
result:
ok AC
Test #5:
score: 0
Accepted
time: 1ms
memory: 3932kb
input:
6
output:
3 2 1 2 4 3 4 6 5 6 8 7 8 3 2 3 4 2 4 7 6 7 8 6 8 5 4 5 6 4 6 7 4 7 8 4 8
result:
ok AC
Test #6:
score: 0
Accepted
time: 1ms
memory: 3824kb
input:
7
output:
3 2 1 2 4 3 4 6 5 6 8 7 8 3 2 3 4 2 4 7 6 7 8 6 8 5 4 5 6 4 6 7 4 7 8 4 8
result:
ok AC
Test #7:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
8
output:
3 2 1 2 4 3 4 6 5 6 8 7 8 3 2 3 4 2 4 7 6 7 8 6 8 5 4 5 6 4 6 7 4 7 8 4 8
result:
ok AC
Test #8:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
9
output:
4 2 1 2 4 3 4 6 5 6 9 8 9 3 2 3 4 2 4 7 6 7 10 9 10 5 4 5 6 4 6 7 4 7 11 10 11 8 7 8 9 7 9 10 7 10 11 7 11
result:
ok AC
Test #9:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
10
output:
4 2 1 2 4 3 4 6 5 6 9 8 9 3 2 3 4 2 4 7 6 7 10 9 10 5 4 5 6 4 6 7 4 7 11 10 11 8 7 8 9 7 9 10 7 10 11 7 11
result:
ok AC
Test #10:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
11
output:
4 2 1 2 4 3 4 6 5 6 9 8 9 3 2 3 4 2 4 7 6 7 10 9 10 5 4 5 6 4 6 7 4 7 11 10 11 8 7 8 9 7 9 10 7 10 11 7 11
result:
ok AC
Test #11:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
12
output:
5 2 1 2 5 4 5 8 7 8 11 10 11 3 2 3 6 5 6 9 8 9 12 11 12 4 3 4 5 3 5 6 3 6 13 12 13 7 6 7 8 6 8 9 6 9 2000 2000 2000 10 9 10 11 9 11 12 9 12 13 9 13
result:
ok AC
Test #12:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
13
output:
5 2 1 2 5 4 5 8 7 8 11 10 11 3 2 3 6 5 6 9 8 9 12 11 12 4 3 4 5 3 5 6 3 6 13 12 13 7 6 7 8 6 8 9 6 9 2000 2000 2000 10 9 10 11 9 11 12 9 12 13 9 13
result:
ok AC
Test #13:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
14
output:
6 2 1 2 6 5 6 10 9 10 14 13 14 3 2 3 7 6 7 11 10 11 15 14 15 4 3 4 8 7 8 12 11 12 16 15 16 5 4 5 6 4 6 7 4 7 8 4 8 9 8 9 10 8 10 11 8 11 12 8 12 13 12 13 14 12 14 15 12 15 16 12 16
result:
ok AC
Test #14:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
15
output:
6 2 1 2 6 5 6 10 9 10 14 13 14 3 2 3 7 6 7 11 10 11 15 14 15 4 3 4 8 7 8 12 11 12 16 15 16 5 4 5 6 4 6 7 4 7 8 4 8 9 8 9 10 8 10 11 8 11 12 8 12 13 12 13 14 12 14 15 12 15 16 12 16
result:
ok AC
Test #15:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
16
output:
6 2 1 2 6 5 6 10 9 10 14 13 14 3 2 3 7 6 7 11 10 11 15 14 15 4 3 4 8 7 8 12 11 12 16 15 16 5 4 5 6 4 6 7 4 7 8 4 8 9 8 9 10 8 10 11 8 11 12 8 12 13 12 13 14 12 14 15 12 15 16 12 16
result:
ok AC