Submission #356688

#TimeUsernameProblemLanguageResultExecution timeMemory
356688urd05팀들 (IOI15_teams)C++14
Compilation error
0 ms0 KiB
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;

int n;
int a[100000];
int b[100000];
typedef pair<int,int> P;
P ind[100000];
int k[100000];

void init(int N, int A[], int B[]) {
    n=N;
    for(int i=0;i<n;i++) {
        a[i]=A[i];
        b[i]=B[i];
        ind[i]=P(a[i],i);
    }
    sort(ind,ind+n);
}

int can(int M, int K[]) {
    m=M;
    for(int i=0;i<m;i++) {
        k[i]=K[i];
    }
    sort(k,k+m);
    int in=0;
    priority_queue<int,vector<int>,greater<int>> pq;
    for(int i=0;i<m;i++) {
        while (in<n&&ind[in].first<=k[i]) {
            pq.push(b[ind[in].second]);
            in++;
        }
        for(int j=0;j<k[i];j++) {
            if (pq.empty()||pq.top()<k[i]) {
                return 0;
            }
            pq.pop();
        }
    }
	return 1;
}

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:23:5: error: 'm' was not declared in this scope
   23 |     m=M;
      |     ^