QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#608008 | #5113. Bridge | ice_cup | WA | 875ms | 28144kb | C++14 | 1.3kb | 2024-10-03 17:42:39 | 2024-10-03 17:42:39 |
Judging History
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;
}
assert(tot<=100);
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=1;k<=tot;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: 3668kb
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: 0
Accepted
time: 781ms
memory: 25904kb
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 3 2 1 2 1 2 3 3 1 1 2 1 3 3 2 1 3 2 1 2 1 2 2 2 2 1 1 2 1 3 2 1 3 2 1 3 2 2 1 3 3 2 3 2 3 1 2 1 1 2 3 2 1 3 2 3 2 3 2 2 1 1 2 1 1 2 3 2 1 1 3 1 1 2 2 3 2 2 1 1 1 2 3 3 1 1 2 1 1 3 1 3 2 3 2 3 2 2 2 3 3 2 2 2 3 3 2 2 2 3 1 2 1 1 3 2 3 2 2 2 1 1 1 3 3 3 2 1 1 3 3 3 1 1 2 3 2 3 3 3 3 2 3 ...
result:
ok 60761 numbers
Test #3:
score: 0
Accepted
time: 2ms
memory: 7788kb
input:
100000 5 20 1 40277 1 2 55431 2 22404 2 29137 2 10206 2 72758 2 92880 1 96104 2 2 12641 1 99618 2 2 88481 1 76531 3 1 91957 5 1 23999 2 2 35922 1 69730 5 1 16353 2 1 90312 1 1 75264 5 2 77283
output:
55431 22404 29137 10206 72758 92880 12641 88481 35922 77283
result:
ok 10 numbers
Test #4:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
3 5 20 2 3 1 2 2 2 3 1 1 4 2 1 1 2 5 1 1 1 2 1 2 2 2 1 2 1 2 2 2 3 2 3 2 1 2 1 2 1 2 3 2 2 2 3
output:
3 2 2 2 3 2 2 3 1 1 2 2 2 1 3 1
result:
ok 16 numbers
Test #5:
score: -100
Wrong Answer
time: 875ms
memory: 28144kb
input:
200 100000 99995 1 180 45150 2 137 1 97 78979 1 14 74747 1 151 41036 1 178 88736 1 26 50618 1 132 72623 1 95 37475 2 184 1 31 44675 1 183 14874 1 66 14597 2 191 2 102 1 27 61558 1 36 39304 2 119 2 185 1 156 50000 2 200 2 152 1 17 51778 1 39 39403 2 168 1 50 67213 1 92 56771 2 28 2 196 1 99 29006 2 4...
output:
137 184 191 102 119 185 200 151 168 27 196 43 73 16 28 64 88 106 139 117 90 131 64 64 107 11 38 149 133 184 166 20 95 185 71 85 151 96 106 103 91 45 195 112 82 113 183 178 47 112 12 185 41 153 77 179 44 165 84 111 192 161 144 33 139 9 37 38 177 45 146 83 88 166 1 180 175 180 12 166 186 44 2 115 124 ...
result:
wrong answer 1461st numbers differ - expected: '187', found: '181'