QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#469050 | #5033. Y 君的序列 | Kevin5307 | Compile Error | / | / | C++23 | 1.0kb | 2024-07-09 11:53:44 | 2024-07-09 11:53:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
void SEQ(int n,int m)
{
vector<int> b(n+1),a(n+1);
for(int i=1;i<=n;i++)
{
a[i]=i;
b[i]=Get(i);
}
answer(1);
auto myadd=[&](int x,int y)
{
assert(x!=y);
assert(a[x]%2==0);
add(x,y);
a[y]+=a[x]/2;
a[x]/=2;
};
for(int i=n;i>=1;i--)
{
int pa,pb;
for(int j=1;j<=n;j++)
{
if(a[j]==i) pa=j;
if(b[j]==i) pb=j;
}
if(pa==pb) continue;
int p1;
for(int j=1;j<=n;j++)
if(a[j]==1)
p1=j;
if(a[pb]==2)
myadd(pb,p1);
else
{
int pd;
for(int j=1;j<=n;j++)
if(a[j]==a[pb]-1)
pd=j;
while(a[pb]!=1)
if(a[pb]%2)
myadd(pd,pb);
else
myadd(pb,pd);
myadd(pd,p1);
}
int pc;
for(int j=1;j<=n;j++)
if(a[j]==i-1)
pc=j;
while(a[pa]!=1)
if(a[pa]%2)
myadd(pc,pa);
else
myadd(pa,pc);
myadd(pc,pb);
}
int p1,p2;
for(int i=1;i<=n;i++)
if(a[i]==1)
p1=i;
else if(a[i]==2)
p2=i;
if(a[p1]!=b[p1])
myadd(p2,p1);
return ;
}
Details
implementer.cpp: In function ‘void {anonymous}::StAr_WaRs::main()’: implementer.cpp:46:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 46 | scanf("%d %d",&n,&M); | ~~~~~^~~~~~~~~~~~~~~ implementer.cpp:47:45: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 47 | for (int i=1;i<=n;i++) scanf("%d",&b[i]),a[i]=i; | ~~~~~^~~~~~~~~~~~ answer.code: In function ‘void SEQ(int, int)’: answer.code:9:22: error: ‘Get’ was not declared in this scope 9 | b[i]=Get(i); | ^~~ answer.code:11:9: error: ‘answer’ was not declared in this scope 11 | answer(1); | ^~~~~~ answer.code: In lambda function: answer.code:16:17: error: ‘add’ was not declared in this scope; did you mean ‘std::filesystem::perm_options::add’? 16 | add(x,y); | ^~~ | std::filesystem::perm_options::add In file included from /usr/include/c++/13/filesystem:48, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:200, from answer.code:1: /usr/include/c++/13/bits/fs_fwd.h:211:7: note: ‘std::filesystem::perm_options::add’ declared here 211 | add = 0x2, | ^~~