QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#134686 | #5420. Inscryption | heaksicn | Compile Error | / | / | C++17 | 1.0kb | 2023-08-04 15:14:53 | 2023-08-04 15:14:54 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-08-04 15:14:54]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-08-04 15:14:53]
- 提交
answer
//Man always remember love because of romance only!
#include<bits/stdc++.h>
using namespace std;
inline int read(){
int X=0,w=0; char ch=0;
while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
return w?-X:X;
}
inline void write(int x){
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
int a[1000010];
int q[1000010],cnt;
int gcd(int x,int y){
if(y==0) return x;
return gcd(y,x%y);
}
int a[1000010];
inline void out(int x,int y){
if(!x)cout<<"0 1\n";
else{
int g=__gcd(x,y);
x/=g;y/=g;
cout<<x<<' '<<y<<'\n';
}
}
int main(){
a[0]=1;
int T=read();
for(int i=1;i<=T;i++){
int n=read();
int x=0,fl=0;
for(int j=1;j<=n;j++)cin>>a[j];
for(int j=0;j<=n;j++){
if(a[j]>=0)x++;
else x--;
if(x<=0)fl=1;
}
if(fl)cout<<"-1\n";
else{
int x=0,y=0;
for(int j=0;j<=n;j++){
if(a[j]==1)x++,y++;
else x--;
if(x<=0)x+=2,y++;
}
out(y,2*y-(n+1));
}
}
return 0;
}
详细
answer.code:21:5: error: redefinition of ‘int a [1000010]’ 21 | int a[1000010]; | ^ answer.code:15:5: note: ‘int a [1000010]’ previously declared here 15 | int a[1000010]; | ^