QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#567171#9310. Permutation Counting 4liaoxiyan233WA 0ms3780kbC++171.3kb2024-09-16 09:29:272024-09-16 09:29:27

Judging History

你现在查看的是最新测评结果

  • [2024-09-18 14:56:40]
  • hack成功,自动添加数据
  • (/hack/835)
  • [2024-09-18 14:41:06]
  • hack成功,自动添加数据
  • (/hack/831)
  • [2024-09-17 12:14:52]
  • hack成功,自动添加数据
  • (/hack/825)
  • [2024-09-16 09:29:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3780kb
  • [2024-09-16 09:29:27]
  • 提交

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;
}

詳細信息

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'