QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#607977#5113. Bridgeice_cupWA 519ms25784kbC++141.3kb2024-10-03 17:27:502024-10-03 17:27:50

Judging History

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

  • [2024-10-03 17:27:50]
  • 评测
  • 测评结果:WA
  • 用时:519ms
  • 内存:25784kb
  • [2024-10-03 17:27:50]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MID int mid=(l+r)>>1;
#define ls p<<1
#define rs p<<1|1
#define endl '\n'
int n,m,q,cnt[100100],B=1000,l[110],r[110],c[110][100100],tot;
bool vis[110][100100];
struct node{
	int op,a,b;
}Q[100100];
bool operator<(node a,node b){
	return a.b>b.b;
}
set<node>s[110];
int main(){
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	cin>>n>>m>>q;
	for(int i=1;i<=q;i++){
		cin>>Q[i].op>>Q[i].a;
		if(Q[i].op==1)cin>>Q[i].b,cnt[Q[i].b]++;
	}
	for(int i=1;i<=m;i++){
		tot++;
		l[tot]=i;
		int tmp=0;
		int j;
		for(j=i;tmp<=B&&j<=m;j++){
			tmp+=cnt[j];
		}
		r[tot]=i=j-1;
	}
	for(int k=1;k<=tot;k++){
		for(int i=1;i<=n;i++){
			c[k][i]=i;
		}
	}
	for(int i=1;i<=q;i++){
		int op=Q[i].op,a=Q[i].a,b=Q[i].b;
		if(op==1){
			int k;
			for(k=1;k<=tot;k++){
				if(l[k]<=b&&b<=r[k])break;
			}
			if(!vis[k][a]&&!vis[k][a+1]){
				s[k].insert(Q[i]);
				swap(c[k][a],c[k][a+1]);
			}
			else{
				s[k].insert(Q[i]);
				for(node tmp:s[k]){
					c[k][tmp.a]=tmp.a;
					c[k][tmp.a+1]=tmp.a+1;
				}
				// cout<<endl<<endl;
				for(node tmp:s[k]){
					swap(c[k][tmp.a],c[k][tmp.a+1]);
				}
			}
			vis[k][a]=vis[k][a+1]=1;
		}
		else{
			for(int k=tot;k>=1;k--){
				a=c[k][a];
			}
			cout<<a<<endl;
		}
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3696kb

input:

3 4 13
2 2
1 1 3
2 1
2 2
2 3
1 2 4
2 1
2 2
2 3
1 2 1
2 1
2 2
2 3

output:

2
2
1
3
3
1
2
3
2
1

result:

ok 10 numbers

Test #2:

score: -100
Wrong Answer
time: 519ms
memory: 25784kb

input:

3 100000 99997
2 2
2 2
2 3
2 3
2 3
2 3
2 3
1 2 11047
1 1 98732
1 2 90045
1 1 43556
2 1
2 3
1 2 17242
1 1 17027
2 1
1 1 94195
2 1
2 2
2 1
2 3
1 1 34124
1 2 14354
1 2 673
1 2 39812
1 2 35520
1 2 16046
2 3
2 2
1 1 25410
2 3
2 1
2 3
2 2
1 2 55684
2 1
1 2 24811
1 2 92268
1 2 60268
2 2
1 1 89272
1 2 19232...

output:

2
2
3
3
3
3
3
2
1
3
1
3
1
2
3
1
2
3
2
1
3
2
2
1
3
2
3
1
2
1
2
2
1
1
2
1
3
2
1
3
2
1
1
3
3
2
1
1
3
1
1
2
3
2
1
1
2
3
2
1
3
2
3
2
3
2
2
2
2
3
2
2
3
3
2
3
3
2
2
2
3
2
3
2
2
2
2
2
3
2
3
1
1
2
1
1
3
1
3
2
3
2
3
2
2
2
2
3
3
2
2
3
3
2
3
3
1
2
3
2
2
2
3
1
3
3
2
3
3
2
1
1
1
1
3
3
2
2
1
2
2
2
3
2
3
2
2
3
2
3
...

result:

wrong answer 8th numbers differ - expected: '3', found: '2'