QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#116679#6320. Parallel Processing (Hard)AFewSunsWA 1ms3524kbC++142.5kb2023-06-29 19:25:202023-06-29 19:25:23

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-29 19:25:23]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3524kb
  • [2023-06-29 19:25:20]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
namespace my_std{
	#define ll long long
	#define bl bool
	ll my_pow(ll a,ll b,ll mod){
		ll res=1;
		if(!b) return 1;
		while(b){
			if(b&1) res=(res*a)%mod;
			a=(a*a)%mod;
			b>>=1;
		}
		return res;
	}
	ll qpow(ll a,ll b){
		ll res=1;
		if(!b) return 1;
		while(b){
			if(b&1) res*=a;
			a*=a;
			b>>=1;
		}
		return res;
	}
	#define db double
	#define pf printf
	#define pc putchar
	#define fr(i,x,y) for(register ll i=(x);i<=(y);i++)
	#define pfr(i,x,y) for(register ll i=(x);i>=(y);i--)
	#define go(u) for(ll i=head[u];i;i=e[i].nxt)
	#define enter pc('\n')
	#define space pc(' ')
	#define fir first
	#define sec second
	#define MP make_pair
	#define il inline
	#define inf 8e18
	#define random(x) rand()*rand()%(x)
	#define inv(a,mod) my_pow((a),(mod-2),(mod))
	il ll read(){
		ll sum=0,f=1;
		char ch=0;
		while(!isdigit(ch)){
			if(ch=='-') f=-1;
			ch=getchar();
		}
		while(isdigit(ch)){
			sum=sum*10+(ch^48);
			ch=getchar();
		}
		return sum*f;
	}
	il void write(ll x){
		if(x<0){
			x=-x;
			pc('-');
		}
		if(x>9) write(x/10);
		pc(x%10+'0');
	}
	il void writeln(ll x){
		write(x);
		enter;
	}
	il void writesp(ll x){
		write(x);
		space;
	}
}
using namespace my_std;
vector<ll> ans;
ll n,a[1010],b[1010];
ll f7[22]={0,2,4,6,6,3,4,7,7,5,6,7,7};
ll f8[22]={0,2,4,6,8,3,4,7,8,5,6,7,8};
ll f9[22]={0,2,4,6,8,3,4,8,8,5,6,8,8,7,9,9,9};
ll f10[22]={0,2,4,6,8,3,4,8,10,5,6,8,8,7,9,10,10};
ll f11[22]={0,2,4,6,8,3,4,8,10,5,6,8,11,7,9,10,11};
void solve(ll x){
	if(x==7){
		fr(i,1,12) ans.push_back(f7[i]);
		return;
	}
	if(x==8){
		fr(i,1,12) ans.push_back(f8[i]);
		return;
	}
	if(x==9){
		fr(i,1,16) ans.push_back(f8[i]);
		return;
	}
	if(x==10){
		fr(i,1,16) ans.push_back(f8[i]);
		return;
	}
	if(x==11){
		fr(i,1,16) ans.push_back(f8[i]);
		return;
	}
	solve(x-5);
	ll tmp[5]={0,0,0,0,0};
	pfr(i,4,1){
		tmp[i]=ans.back();
		ans.pop_back();
	}
	ans.push_back(tmp[1]);
	ans.push_back(tmp[4]);
	ans.push_back(x-3);
	ans.push_back(x-1);
	ans.push_back(tmp[2]);
	ans.push_back(tmp[3]);
	ans.push_back(x-3);
	ans.push_back(x);
	ans.push_back(x-4);
	ans.push_back(x-2);
	ans.push_back(x-1);
	ans.push_back(x);
}
int main(){
	n=read();
	solve(n);
	fr(i,1,n) a[i]=i;
	writeln(ans.size()/4);
	fr(i,0,(ll)ans.size()/4-1){
		fr(j,1,n) b[j]=a[j];
		fr(j,0,3){
			pf("%lld %lld %lld\n",b[ans[i*4+j]]-1,ans[i*4+j],ans[i*4+j]);
			a[ans[i*4+j]]=b[b[ans[i*4+j]]-1];
		}
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3524kb

input:

17

output:

7
1 2 2
3 4 4
5 6 6
5 6 6
2 3 3
2 4 4
6 7 7
6 7 7
4 5 5
4 7 7
8 9 9
10 11 11
4 6 6
0 7 7
7 9 9
11 12 12
7 8 8
9 12 12
13 14 14
15 16 16
9 10 10
9 11 11
12 14 14
16 17 17
12 13 13
14 15 15
14 16 16
14 17 17

result:

wrong answer Integer 0 violates the range [1, 2000]