QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#392034#6754. SelectionKir1sameWA 0ms3580kbC++201.5kb2024-04-17 02:46:412024-04-17 02:46:42

Judging History

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

  • [2024-04-17 02:46:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3580kb
  • [2024-04-17 02:46:41]
  • 提交

answer

#include<bits/stdc++.h>
//#pragma GCC optimize(3,"Ofast","inline")
using namespace std;
typedef long long ll;
typedef double db;
typedef unsigned long long  ull;
typedef pair<int,int> pii;
typedef pair<db,db> pdd;
typedef pair<ll,ll> pll;
void init();
void debug();
#define Clear(a)  memset(a,0,sizeof(a))
#define pb(x) push_back(x)
 
#define INF 1e9+10
const int N = 1e3+10;
const int M = 13210;
const int maxn = 3e5 +10;
const ll mod = 1e9+7;

const bool IN_TEST = 1;

vector<pii> a;
vector<int> gen;

    int n,m,q;
int query(int x)
{
    int gid;
    for (int i=0;i<a.size();i++)
    {
        if (gen[a[i].second] == 1){
            gid = a[i].second;
            break;
        }
    }
    if (gid == x) return 1;

    bool hasg = 0;
    for (int i=0; i<m-1; i++)
    {
        auto [s, id] = a[i];
        if (gen[id] == 1) hasg = 1;
        if (id == x) return 1;
    }
    if (!hasg && a[m-1].second == x) return 1;
    return 0;
}

int main()
{
    cin>>n>>m>>q;
    a.resize(n);
    gen.resize(n);
    for (int i=0;i<n;i++)
    {
        cin>>a[i].first>>gen[i];
        a[i].second = i;
    }
    sort(a.begin(), a.end(), greater<pii>());

    while (q--)
    {
        int type;
        cin>>type;
        if (type == 1){
            int aa,b;
            cin>>aa>>b;
            gen[aa-1] = b;
        }
        else{
            int aa;
            cin>>aa;
            cout<<query(aa-1)<<endl;
        }
    }
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3580kb

input:

3 2 3
3 0
1 1
2 0
2 2
1 2 0
2 2

output:

1
1

result:

wrong answer 2nd numbers differ - expected: '0', found: '1'