제출 #242867

#제출 시각아이디문제언어결과실행 시간메모리
242867godwind팀들 (IOI15_teams)C++14
0 / 100
4072 ms16760 KiB
#include "teams.h" #include <iostream> #include <vector> #include <algorithm> #include <random> #include <set> #include <map> #include <queue> #include <cstring> #include <cmath> #include <bitset> #include <iomanip> #include <functional> using namespace std; const int N = 100 * 1000 + 228; int n; int a[N], b[N]; bool used[N]; 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]; } } int can(int M, int K[]) { int sum_all = 0; for (int i = 0; i < M; ++i) { sum_all += K[i]; if (sum_all > n) { return 0; } } sort(K, K + M); for (int xxx = 0; xxx < M; ++xxx) { int S = K[xxx]; for (int it = 0; it < S; ++it) { int opt = -1; for (int i = 0; i < n; ++i) { if (a[i] <= S && S <= b[i] && !used[i]) { if (opt == -1) { opt = i; } else { if (b[i] < b[opt]) { opt = i; } } } } if (opt == -1) return 0; used[opt] = 1; } } return 1; }

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

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:23:34: warning: declaration of 'N' shadows a global declaration [-Wshadow]
 void init(int N, int A[], int B[]) {
                                  ^
teams.cpp:17:11: note: shadowed declaration is here
 const int N = 100 * 1000 + 228;
           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...