QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#692812 | #91. Secret Permutation | HJY2022 | Compile Error | / | / | C++20 | 1.1kb | 2024-10-31 15:04:31 | 2024-10-31 15:04:33 |
Judging History
answer
#include<bits/stdc++.h>
#include "permutation.h"
using namespace std;
const int MX = 305;
int a[MX],d[MX],ans[MX],id[MX];bool vis[MX];
bool dfs(int x,int p,int N,int mn,int mx){
if(mx - mn > N - 1 || vis[p + MX])return 0;
ans[x] = p;
if(x == N){
if(p - d[N] == 0 || p + d[N] == 0)return 1;
return 0;
}
vis[p + MX] = true;
if(dfs(x + 1,p + d[x],N,mn,max(mx,p + d[x])))return 1;
if(dfs(x + 1,p - d[x],N,min(mn,p - d[x]),mx))return 1;
vis[p + MX] = false;
return false;
}
void solve(int N){
vector<int > q;q.resize(N);
for(int i = 1;i <= N;i++)id[i] = i;
mt19937 rng(1984);shuffle(id + 1,id + 1 + N,rng);
for(int i = 0;i < N;i++)q[i] = id[i + 1];
a[0] = query(q);int sum = 0;
for(int i = 1;i < N;i++){
int p = 0;
for(int j = i;j >= 1;j--)q[p++] = id[j];
for(int j = N;j > i;j--)q[p++] = id[j];
a[i] = query(q);sum += a[i];
}
sum -= (N - 2) * a[0];sum /= (N - 1);
for(int i = 1;i < N;i++)d[i] = a[0] - a[i] + sum;d[N] = sum;
dfs(1,0,N,0,0);int mn = 1000000000;
for(int i = 1;i <= N;i++)mn = min(mn,ans[i]);
for(int i = 0;i < N;i++)q[id[i + 1] - 1] = ans[i + 1] - mn + 1;
answer(q);
}
Details
answer.code:4:16: error: unable to find numeric literal operator ‘operator"";’ 4 | const int MX = 305; | ^~~~~ answer.code:4:16: note: use ‘-fext-numeric-literals’ to enable more built-in suffixes answer.code:5:41: error: size of array ‘vis’ is not an integral constant-expression 5 | int a[MX],d[MX],ans[MX],id[MX];bool vis[MX]; | ^~ answer.code: In function ‘bool dfs(int, int, int, int, int)’: answer.code:8:9: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 8 | ans[x] = p; | ^~~ | abs answer.code:10:24: error: ‘d’ was not declared in this scope 10 | if(p - d[N] == 0 || p + d[N] == 0)return 1; | ^ answer.code:14:26: error: ‘d’ was not declared in this scope 14 | if(dfs(x + 1,p + d[x],N,mn,max(mx,p + d[x])))return 1; | ^ answer.code:15:26: error: ‘d’ was not declared in this scope 15 | if(dfs(x + 1,p - d[x],N,min(mn,p - d[x]),mx))return 1; | ^ answer.code: In function ‘void solve(int)’: answer.code:22:34: error: ‘id’ was not declared in this scope; did you mean ‘i’? 22 | for(int i = 1;i <= N;i++)id[i] = i; | ^~ | i answer.code:23:35: error: ‘id’ was not declared in this scope 23 | mt19937 rng(1984);shuffle(id + 1,id + 1 + N,rng); | ^~ answer.code:25:9: error: ‘a’ was not declared in this scope 25 | a[0] = query(q);int sum = 0; | ^ answer.code:33:33: error: ‘d’ was not declared in this scope 33 | for(int i = 1;i < N;i++)d[i] = a[0] - a[i] + sum;d[N] = sum; | ^ answer.code:33:58: error: ‘d’ was not declared in this scope 33 | for(int i = 1;i < N;i++)d[i] = a[0] - a[i] + sum;d[N] = sum; | ^ answer.code:35:46: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 35 | for(int i = 1;i <= N;i++)mn = min(mn,ans[i]); | ^~~ | abs answer.code:36:52: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 36 | for(int i = 0;i < N;i++)q[id[i + 1] - 1] = ans[i + 1] - mn + 1; | ^~~ | abs