Submission #67855

#TimeUsernameProblemLanguageResultExecution timeMemory
67855theknife2001Teams (IOI15_teams)C++17
Compilation error
0 ms0 KiB
#include "teams.h"
#include <bits/stdc++.h>
#define ii pair < int , int>
#define se second
#define fi first


using namespace std;
const int N=1e5+55;
ii a[N];
int b[N];
int n;
priority_queue< int , vector < int > , greater < int > > pq;


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

int can(int M, int K[])
{
    for(int i=0;i<m;i++)
    {
        b[K[i]]++;
    }
    int j=0;
    for(int i=1;i<=n;i++)
    {
        while(j<n&&a[j].fi>=i)
            pq.push(a[j++].se);
        int x=b[i]*i;
        while(x>0)
        {
            if(!pq.size())
                return 0;
            pq.pop();
            x--;
        }
    }
	return 1;
}

Compilation message (stderr)

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:16:34: warning: declaration of 'N' shadows a global declaration [-Wshadow]
 void init(int N, int A[], int B[])
                                  ^
teams.cpp:9:11: note: shadowed declaration is here
 const int N=1e5+55;
           ^
teams.cpp:18:9: warning: declaration of 'n' shadows a global declaration [-Wshadow]
     int n=N:
         ^
teams.cpp:12:5: note: shadowed declaration is here
 int n;
     ^
teams.cpp:18:12: error: expected ',' or ';' before ':' token
     int n=N:
            ^
teams.cpp:19:17: error: 'i' was not declared in this scope
     for(int i=0;i<n;i++)
                 ^
teams.cpp:16:24: warning: unused parameter 'A' [-Wunused-parameter]
 void init(int N, int A[], int B[])
                        ^
teams.cpp:16:33: warning: unused parameter 'B' [-Wunused-parameter]
 void init(int N, int A[], int B[])
                                 ^
teams.cpp: In function 'int can(int, int*)':
teams.cpp:26:19: error: 'm' was not declared in this scope
     for(int i=0;i<m;i++)
                   ^
teams.cpp:24:13: warning: unused parameter 'M' [-Wunused-parameter]
 int can(int M, int K[])
             ^