QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#99534 | #6320. Parallel Processing (Hard) | Sorting# | WA | 1ms | 3332kb | C++ | 1.7kb | 2023-04-22 23:04:34 | 2023-04-22 23:04:37 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
const ll mod=998244353;
typedef vector<ll> poly;
const int mb=18;//can change !!!!
int n,z;
pair<int,int>a[1000][4];
vector<int>frogs;
int main(){
ios::sync_with_stdio(false);cin.tie(0);
cin >> n;
while(n%5!=1 && n%5!=3) n++;
frogs.push_back(1);
frogs.push_back(2);frogs.push_back(4);frogs.push_back(7);
int cur=7;
while(cur<=1000){
cur+=4;
frogs.push_back(cur);
}
if(n%5==1){
int m=(n+9)/5;
for(int i=1; i<=m ;i++){
for(int j=1; j<min(i,4) ;j++){
a[i-j][j]={frogs[i]-j,frogs[i]-j+1};
}
a[i][0]={frogs[i-1],frogs[i]};
}
a[m-2][3]={2,3};
a[m-1][2]={4,5};
a[m-1][3]={4,6};
a[m][1]={7,8};
a[m][2]={7,9};
a[m][3]={7,10};
int cur=a[m][0].se;
for(int i=4; i<m ;i++){
a[m+i-3][0]={cur,cur+1};cur++;
for(int j=1; j<=3 ;j++){
a[m+i-3][j]={frogs[i],frogs[i+j]};
}
}
z=2*m-4;
}
else{
int m=(n+12)/5;
for(int i=1; i<=m ;i++){
for(int j=1; j<min(i,4) ;j++){
a[i-j][j]={frogs[i]-j,frogs[i]-j+1};
}
a[i][0]={frogs[i-1],frogs[i]};
}
a[m-2][3]={2,3};
a[m-1][2]={4,5};
a[m-1][3]={4,6};
a[m][1]={7,8};
a[m][2]={7,9};
a[m][3]={7,10};
a[m][0].se--;
a[m-1][1]={frogs[m-1],frogs[m-1]+1};
a[m+1][0]={frogs[m-1],frogs[m-1]+2};
a[m+1][1]={11,12};
a[m+1][2]={11,13};
a[m+1][3]={11,14};
int cur=a[m][0].se;
for(int i=5; i<m-1 ;i++){
a[m+i-3][0]={cur,cur+1};cur++;
for(int j=1; j<=3 ;j++){
a[m+i-3][j]={frogs[i],frogs[i+j]};
}
}
z=2*m-5;
}
cout << z << '\n';
for(int i=1; i<=z ;i++){
for(int j=0; j<4 ;j++){
cout << a[i][j].se << ' ' << a[i][j].fi << ' ' << a[i][j].se << '\n';
}
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3332kb
input:
17
output:
7 2 1 2 4 3 4 6 5 6 9 8 9 4 2 4 7 6 7 10 9 10 13 12 13 7 4 7 11 10 11 14 13 14 17 16 17 11 7 11 15 14 15 18 17 18 3 2 3 15 11 15 16 15 16 5 4 5 6 4 6 18 15 18 8 7 8 9 7 9 10 7 10 17 15 17 12 11 12 13 11 13 14 11 14
result:
wrong answer A[16] is not (1, …, 16)