제출 #412955

#제출 시각아이디문제언어결과실행 시간메모리
412955ScarletSTeams (IOI15_teams)C++17
0 / 100
224 ms16304 KiB
#include <bits/stdc++.h>
using namespace std;

const int N = 5e5+7;
int n;
array<int,2> a[N];

bool cmp(array<int,2>& x, array<int,2> &y)
{
    return x[1] < y[1];
}

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

bool can(int m, int k[])
{
    sort(k,k+m);
    int c=0, x=0;
    for (int i=0;i<n&&c<m;++i)
        if (a[i][0]<=k[c]&&k[c]<=a[i][1])
            if (++x==k[c])
                x=0,++c;
    return c==m;
}

컴파일 시 표준 에러 (stderr) 메시지

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:13:15: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   13 | void init(int N, int A[], int B[])
      |           ~~~~^
teams.cpp:4:11: note: shadowed declaration is here
    4 | const int N = 5e5+7;
      |           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...