제출 #67753

#제출 시각아이디문제언어결과실행 시간메모리
67753funcsr팀들 (IOI15_teams)C++17
0 / 100
491 ms54228 KiB
#include "teams.h" #include <vector> #include <cassert> #include <algorithm> #include <iostream> using namespace std; #define rep(i, n) for (int i=0; i<(n); i++) #define all(x) x.begin(), x.end() #define uniq(x) x.erase(unique(all(x)), x.end()) #define index(x, y) (int)(lower_bound(all(x), y)-x.begin()) int N; int T[500001]; int Rlt[500001]; int Lgt[500001]; int count(int l, int r) { assert(l <= r); return N-(l>0?Rlt[l-1]:0)-(r+1<=N?Lgt[r+1]:0); } void init(int NN, int A[], int B[]) { N = NN; rep(i, N) { T[A[i]]++; if (B[i]+1<=N) T[B[i]+1]--; Rlt[B[i]]++; Lgt[A[i]]++; } rep(i, N) T[i+1] += T[i]; rep(i, N) Rlt[i+1] += Rlt[i]; for (int i=N; i>0; i--) Lgt[i-1] += Lgt[i]; } int can(int M, int K[]) { int sum = 0; rep(i, M) sum += K[i]; if (sum > N) return 0; sort(K, K+M); rep(l, M) { int sum = 0; for (int r=l; r<M; r++) { sum += K[r]; if (sum-count(K[l], K[r]) > 0) return 0; } } return 1; }

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:40:9: warning: declaration of 'sum' shadows a previous local [-Wshadow]
     int sum = 0;
         ^~~
teams.cpp:35:7: note: shadowed declaration is here
   int sum = 0;
       ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...