QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#740581 | #5173. 染色 | jinqihao2023 | Compile Error | / | / | C++14 | 1.3kb | 2024-11-13 10:37:01 | 2024-11-13 10:37:02 |
Judging History
This is the latest submission verdict.
- [2024-11-13 10:37:02]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-11-13 10:37:01]
- Submitted
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
int n,q,a[N],to[21][N],lst[N];
namespace IO {
const int SIZE=(1<<21)+1;
char ibuf[SIZE],*iS,*iT,obuf[SIZE],*oS=obuf,*oT=oS+SIZE-1,c,qu[55];int f, qr;
#define gc() (iS==iT?(iT=(iS=ibuf)+fread(ibuf,1,SIZE,stdin),(iS==iT?EOF:*iS++)):*iS++)
inline void flush(){fwrite(obuf,1,oS-obuf,stdout),oS=obuf;}
inline void putc(char x){*oS++=x;if(oS==oT)flush();}
template <class I>
inline void read(I &x){
for(f=1,c=gc();c<'0'||c>'9';c=gc())if(c=='-')f=-1;
for(x=0;c<='9'&&c>='0';c=gc())x=x*10+(c&15);x*=f;
}
template <class I>
inline void print(I x){
if(!x)putc('0');if(x<0)putc('-'),x=-x;
while(x)qu[++qr]=x%10+'0',x/=10;
while(qr)putc(qu[qr --]);
}
struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
int main()
{
read(n),read(q);
for(int i=1;i<=n;i++)read(a[i]);
for(int i=1;i<=n;i++)lst[i]=n+1;
to[0][n+1]=n+1;
for(int i=n;i>=1;i--)to[0][i]=min(to[0][i+1],lst[a[i]]),lst[a[i]]=i;
for(int i=1;i<=20;i++)for(int j=1;j<=n+1;j++)to[i][j]=to[i-1][to[i-1][j]];
while(q--)
{
int x,y;
read(x),read(y);
if(x>y)swap(x,y);
int num=(y-x)*2;
for(int i=__lg(y-x);i>=0;i--)if(to[i][x]<=y)x=to[i][x],num-=(1<<i);
print(num),putc('\n');
}
return 0;
}
详细
answer.code: In function ‘int main()’: answer.code:26:9: error: ‘read’ was not declared in this scope; did you mean ‘IO::read’? 26 | read(n),read(q); | ^~~~ | IO::read answer.code:12:17: note: ‘IO::read’ declared here 12 | inline void read(I &x){ | ^~~~ answer.code:39:17: error: ‘print’ was not declared in this scope; did you mean ‘IO::print’? 39 | print(num),putc('\n'); | ^~~~~ | IO::print answer.code:17:17: note: ‘IO::print’ declared here 17 | inline void print(I x){ | ^~~~~ answer.code:39:32: error: too few arguments to function ‘int putc(int, FILE*)’ 39 | print(num),putc('\n'); | ~~~~^~~~~~ In file included from /usr/include/c++/13/cstdio:42, from /usr/include/c++/13/ext/string_conversions.h:45, from /usr/include/c++/13/bits/basic_string.h:4097, from /usr/include/c++/13/string:54, from /usr/include/c++/13/bitset:52, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52, from answer.code:1: /usr/include/stdio.h:522:12: note: declared here 522 | extern int putc (int __c, FILE *__stream); | ^~~~