繁体   English   中英

SPOJ RPLD - 我的代码应该更新什么才能被在线评审接受

[英]SPOJ RPLD - What should be updated in my code to get accepted in online judge

我使用了一个地图并在该地图中实现了一对来计算测试用例中是否存在类似类型的数据。 如果它存在,它应该给出一个“不可能”的输出。 给定的测试用例对我的代码是正确的,但是在检查其他测试用例时它向我显示了错误的答案。 我无法理解我的代码有什么问题。 问题链接: https : //www.spoj.com/problems/RPLD/en/

#include<bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define Charpoka ios_base::sync_with_stdio(false), cin.tie(NULL),cout.tie(NULL)
#define err 10e-8
#define pb push_back
#define MAX 40000
#define MOD 1e9+7
#define base 10
#define NULL_VALUE -99999
//#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define oset tree< pair<int,int>, null_type,less< pair<int,int> >, rb_tree_tag,tree_order_statistics_node_update>
#define omultiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MAXN 100
typedef long long int ll;

int main()
{
    Charpoka;
    int t,cnt=1;
    cin>>t;
    while(t--)
    {
        int n,k;
        cin>>n>>k;
        map< pair<int,int>,int>mp;
        for(int i=1;i<=k;i++)
        {
            int a,b;
            cin>>a>>b;
            mp[{a,b}]++;
        }
        map< pair<int,int>, int>::iterator it;
        bool flag=true;
        for(it=mp.begin();it!=mp.end();it++)
        {
            if(it->second>=2)
            {
                flag=false;
                break;
            }
        }
        if(flag==false)
            cout<<"Scenerio #"<<cnt<<": impossible"<<endl;
        else
            cout<<"Scenerio #"<<cnt<<": possible"<<endl;
        cnt++;
    }
    return 0;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM