QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#567171 | #9310. Permutation Counting 4 | liaoxiyan233 | WA | 0ms | 3780kb | C++17 | 1.3kb | 2024-09-16 09:29:27 | 2024-09-16 09:29:27 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define N 1000005
using namespace std;
int n,T;
int min(int x,int y){
return x<y ? x : y;
}
int max(int x,int y){
return x>y ? x : y;
}
int read(){
int i=0;char ch;
while(!isdigit(ch)){
ch=getchar();
}
while(isdigit(ch)){
i=(i<<3)+(i<<1)+(ch^48);
ch=getchar();
}
return i;
}
void Solve(){
n=read();
vector<vector<int>>E(n+2);
int x,y;
for(int i=1;i<=n;i++){
x=read();
y=read();
E[x].push_back(y);
}
for(int i=1;i<=n;i++){
sort(E[i].begin(),E[i].end(),greater<>());
}
int ju=0;
for(int i=1;i<=n;i++){
int tmp=1e9;
ju=0;
if(E[i].size()==0){
cout<<0<<endl;
return;
}
tmp=E[i][0];
for(int j=1;j<E[i].size();j++){
if(E[i][j]=E[i][j-1]){
ju=1;
break;
}
E[tmp+1].push_back(E[i][j]);
}
if(ju==1){
cout<<0<<endl;
return;
}
}
cout<<1<<endl;
return;
}
signed main()
{
//cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
T=read();
for(int i=1;i<=T;++i){
Solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3780kb
input:
4 5 1 2 1 5 1 2 1 2 2 2 5 1 1 2 4 2 3 5 5 3 4 5 3 5 1 2 3 4 3 5 3 3 5 1 5 1 4 4 5 5 5 1 2
output:
0 0 0 0
result:
wrong answer 2nd words differ - expected: '1', found: '0'