QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#741091#9432. PermutationL_WaveAC ✓275ms5816kbC++201.8kb2024-11-13 13:18:232024-11-13 13:18:24

Judging History

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

  • [2024-11-13 13:18:24]
  • 评测
  • 测评结果:AC
  • 用时:275ms
  • 内存:5816kb
  • [2024-11-13 13:18:23]
  • 提交

answer

// Problem: K. Permutation
// Author: XZC(L_Wave)
// Language: Cpp/G++20
// Contest: Hydro
// URL: http://www.nfls.com.cn:10611/p/16530?tid=67333207920ee48161ddde7f
// Memory Limit: 1024 MB
// Time Limit: 1000 ms
// Create Time: not 2024-11-13 11:43:37, but 1926-08-17 11:45:14
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i <= i##ABRACADABRA; i++)
#define drep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i >= i##ABRACADABRA; i--)
using namespace std;
using ll = long long;

int n,res[1000010];

int ask(int x,int y,int piv){
  putchar(48);
  rep(i,1,piv)printf(" %d",x);
  rep(i,piv+1,n)printf(" %d",y);
  puts(""),fflush(stdout);
  scanf("%d",&piv);
  return piv;
}

void solve(int l,int r,vector<int>V){
  if (l==r)return void(res[l]=!V.size()?0:V[0]);
  vector<int>L,R,U;
  int mid=(l+r)>>1;
  for (auto v:V){
    if ((int)L.size()==mid-l+1){
      R.push_back(v);
      continue;
    }else if ((int)R.size()==r-mid){
      L.push_back(v);
      continue;
    }else{
      if (!U.size()){
        U.push_back(v);
        continue;
      }
      int x=ask(v,U[0],mid);
      if (x==1){
        U.push_back(v);
        continue;
      }
      if (!x){
        for (auto t:U)L.push_back(t);
        U.clear();
        R.push_back(v);
      }else{
        for (auto t:U)R.push_back(t);
        U.clear();
        L.push_back(v);
      }
    }
  }
  if ((int)L.size()+(int)U.size()==mid-l+1)
    for (auto t:U)L.push_back(t);
  else
    for (auto t:U)R.push_back(t);
  solve(l,mid,L),solve(mid+1,r,R);
}

int main() {
  scanf("%d",&n);
  vector<int>V;
  rep(i,1,n)V.push_back(i);
  solve(1,n,V);
  putchar(49);
  rep(i,1,n)printf(" %d",res[i]);
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3744kb

input:

5
2
1
0
2
0
0

output:

0 2 2 2 1 1
0 4 4 4 3 3
0 5 5 5 3 3
0 3 3 2 2 2
0 4 3 3 3 3
0 5 5 5 5 1
1 3 4 2 1 5

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 256ms
memory: 3764kb

input:

1000
0
2
2
1
2
2
1
2
0
1
1
1
1
1
0
1
1
1
2
1
1
2
2
1
1
0
1
1
1
0
2
1
2
0
0
2
1
2
2
0
1
2
1
1
1
0
1
2
1
1
1
1
2
1
1
0
2
1
1
1
1
2
0
0
1
0
2
2
1
1
1
0
1
1
0
1
0
0
0
1
1
1
1
0
1
1
1
0
1
0
1
1
0
1
2
2
1
1
1
2
2
1
1
2
1
1
0
0
0
1
0
2
0
0
0
1
1
1
0
1
1
1
1
1
2
1
0
1
1
2
2
1
0
0
1
2
0
1
2
1
1
2
2
2
0
1
0
1...

output:

0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

result:

ok Accepted

Test #3:

score: 0
Accepted
time: 1ms
memory: 5816kb

input:

1

output:

1 1

result:

ok Accepted

Test #4:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

2
2

output:

0 2 1
1 2 1

result:

ok Accepted

Test #5:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

3
0
2

output:

0 2 2 1
0 3 1 1
1 3 1 2

result:

ok Accepted

Test #6:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

4
1
2
0
2

output:

0 2 2 1 1
0 3 3 1 1
0 4 3 3 3
0 2 2 2 1
1 3 4 2 1

result:

ok Accepted

Test #7:

score: 0
Accepted
time: 0ms
memory: 4052kb

input:

6
2
1
0
2
0
0
0

output:

0 2 2 2 1 1 1
0 4 4 4 3 3 3
0 5 5 5 3 3 3
0 3 3 2 2 2 2
0 4 3 3 3 3 3
0 5 5 5 5 5 1
0 6 6 6 6 1 1
1 3 4 2 1 6 5

result:

ok Accepted

Test #8:

score: 0
Accepted
time: 0ms
memory: 4060kb

input:

7
1
1
0
1
2
1
2
0
2
2
2

output:

0 2 2 2 2 1 1 1
0 3 3 3 3 1 1 1
0 4 4 4 4 1 1 1
0 6 6 6 6 5 5 5
0 7 7 7 7 5 5 5
0 2 2 1 1 1 1 1
0 3 3 1 1 1 1 1
0 7 3 3 3 3 3 3
0 2 2 2 1 1 1 1
0 5 5 5 5 5 5 4
0 6 6 6 6 6 5 5
1 3 7 2 1 6 5 4

result:

ok Accepted

Test #9:

score: 0
Accepted
time: 1ms
memory: 4056kb

input:

8
1
1
0
1
2
1
2
0
2
2
0
2
0

output:

0 2 2 2 2 1 1 1 1
0 3 3 3 3 1 1 1 1
0 4 4 4 4 1 1 1 1
0 6 6 6 6 5 5 5 5
0 7 7 7 7 5 5 5 5
0 2 2 1 1 1 1 1 1
0 3 3 1 1 1 1 1 1
0 7 3 3 3 3 3 3 3
0 2 2 2 1 1 1 1 1
0 5 5 5 5 5 5 4 4
0 8 8 8 8 8 8 6 6
0 6 6 6 6 6 5 5 5
0 8 8 8 8 8 8 8 4
1 3 7 2 1 6 5 4 8

result:

ok Accepted

Test #10:

score: 0
Accepted
time: 1ms
memory: 3748kb

input:

9
1
1
0
1
2
2
2
1
0
2
0
0
1
0
2
2

output:

0 2 2 2 2 2 1 1 1 1
0 3 3 3 3 3 1 1 1 1
0 4 4 4 4 4 1 1 1 1
0 6 6 6 6 6 5 5 5 5
0 7 7 7 7 7 5 5 5 5
0 9 9 9 9 9 8 8 8 8
0 2 2 2 1 1 1 1 1 1
0 7 7 7 3 3 3 3 3 3
0 9 9 9 3 3 3 3 3 3
0 3 3 2 2 2 2 2 2 2
0 7 3 3 3 3 3 3 3 3
0 9 9 9 9 1 1 1 1 1
0 5 5 5 5 5 5 5 4 4
0 6 6 6 6 6 6 6 4 4
0 5 5 5 5 5 5 4 4 4
...

result:

ok Accepted

Test #11:

score: 0
Accepted
time: 1ms
memory: 3852kb

input:

10
0
0
1
2
2
2
0
1
0
0
0
2
0
1
0
2
2

output:

0 2 2 2 2 2 1 1 1 1 1
0 4 4 4 4 4 3 3 3 3 3
0 6 6 6 6 6 5 5 5 5 5
0 7 7 7 7 7 5 5 5 5 5
0 9 9 9 9 9 8 8 8 8 8
0 3 3 3 1 1 1 1 1 1 1
0 9 9 9 7 7 7 7 7 7 7
0 7 7 3 3 3 3 3 3 3 3
0 10 10 3 3 3 3 3 3 3 3
0 7 3 3 3 3 3 3 3 3 3
0 9 9 9 9 1 1 1 1 1 1
0 4 4 4 4 4 4 4 4 2 2
0 6 6 6 6 6 6 6 6 5 5
0 5 5 5 5 5 ...

result:

ok Accepted

Test #12:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

11
0
0
0
0
1
0
2
2
2
1
0
0
0
0
2
0
0
0
0

output:

0 2 2 2 2 2 2 1 1 1 1 1
0 4 4 4 4 4 4 3 3 3 3 3
0 6 6 6 6 6 6 5 5 5 5 5
0 8 8 8 8 8 8 7 7 7 7 7
0 10 10 10 10 10 10 9 9 9 9 9
0 11 11 11 11 11 11 9 9 9 9 9
0 3 3 3 1 1 1 1 1 1 1 1
0 7 7 7 5 5 5 5 5 5 5 5
0 10 10 10 9 9 9 9 9 9 9 9
0 7 7 3 3 3 3 3 3 3 3 3
0 10 10 3 3 3 3 3 3 3 3 3
0 7 3 3 3 3 3 3 3 3...

result:

ok Accepted

Test #13:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

12
0
0
0
0
1
0
2
2
2
1
0
0
0
0
2
1
2
1
0
0
0
0

output:

0 2 2 2 2 2 2 1 1 1 1 1 1
0 4 4 4 4 4 4 3 3 3 3 3 3
0 6 6 6 6 6 6 5 5 5 5 5 5
0 8 8 8 8 8 8 7 7 7 7 7 7
0 10 10 10 10 10 10 9 9 9 9 9 9
0 11 11 11 11 11 11 9 9 9 9 9 9
0 3 3 3 1 1 1 1 1 1 1 1 1
0 7 7 7 5 5 5 5 5 5 5 5 5
0 10 10 10 9 9 9 9 9 9 9 9 9
0 7 7 3 3 3 3 3 3 3 3 3 3
0 10 10 3 3 3 3 3 3 3 3 3...

result:

ok Accepted

Test #14:

score: 0
Accepted
time: 0ms
memory: 3692kb

input:

13
0
2
0
0
1
0
2
0
2
2
2
2
2
2
2
2
0
1
2
2
0
2
2

output:

0 2 2 2 2 2 2 2 1 1 1 1 1 1
0 4 4 4 4 4 4 4 3 3 3 3 3 3
0 6 6 6 6 6 6 6 5 5 5 5 5 5
0 8 8 8 8 8 8 8 7 7 7 7 7 7
0 10 10 10 10 10 10 10 9 9 9 9 9 9
0 11 11 11 11 11 11 11 9 9 9 9 9 9
0 13 13 13 13 13 13 13 12 12 12 12 12 12
0 4 4 4 4 1 1 1 1 1 1 1 1 1
0 7 7 7 7 5 5 5 5 5 5 5 5 5
0 10 10 10 10 9 9 9 9...

result:

ok Accepted

Test #15:

score: 0
Accepted
time: 0ms
memory: 3744kb

input:

14
0
2
1
2
2
0
2
0
0
1
0
2
2
2
2
2
0
0
1
2
1
2
0
0
0
2

output:

0 2 2 2 2 2 2 2 1 1 1 1 1 1 1
0 4 4 4 4 4 4 4 3 3 3 3 3 3 3
0 6 6 6 6 6 6 6 5 5 5 5 5 5 5
0 7 7 7 7 7 7 7 5 5 5 5 5 5 5
0 9 9 9 9 9 9 9 8 8 8 8 8 8 8
0 11 11 11 11 11 11 11 10 10 10 10 10 10 10
0 13 13 13 13 13 13 13 12 12 12 12 12 12 12
0 4 4 4 4 1 1 1 1 1 1 1 1 1 1
0 9 9 9 9 7 7 7 7 7 7 7 7 7 7
0 ...

result:

ok Accepted

Test #16:

score: 0
Accepted
time: 1ms
memory: 3780kb

input:

15
0
2
1
2
2
1
0
0
0
0
0
0
2
2
2
2
2
2
0
0
0
2
1
0
0
2
2
2
1
0
0

output:

0 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1
0 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3
0 6 6 6 6 6 6 6 6 5 5 5 5 5 5 5
0 7 7 7 7 7 7 7 7 5 5 5 5 5 5 5
0 9 9 9 9 9 9 9 9 8 8 8 8 8 8 8
0 11 11 11 11 11 11 11 11 10 10 10 10 10 10 10
0 12 12 12 12 12 12 12 12 10 10 10 10 10 10 10
0 14 14 14 14 14 14 14 14 13 13 13 13 13 13 13...

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 246ms
memory: 3764kb

input:

975
0
2
2
1
2
2
1
2
0
1
1
1
1
1
0
1
1
1
2
1
1
2
2
1
1
0
1
1
1
0
2
1
2
0
0
2
1
2
2
0
1
2
1
1
1
0
1
2
1
1
1
1
2
1
1
0
2
1
1
1
1
2
0
0
1
0
2
2
1
1
1
0
1
1
0
1
0
0
0
1
1
1
1
0
1
1
1
0
1
0
1
1
0
1
2
2
1
1
1
2
2
2
2
0
0
0
0
1
0
2
0
0
0
1
1
1
0
1
1
1
1
1
2
1
0
1
1
2
2
1
0
0
1
2
0
1
2
1
1
2
2
2
0
1
0
1
0
1
...

output:

0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2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