제출 #67755

#제출 시각아이디문제언어결과실행 시간메모리
67755funcsr팀들 (IOI15_teams)C++17
0 / 100
380 ms17080 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[]) { long long sum = 0; rep(i, M) sum += K[i]; if (sum > N) return 0; sort(K, K+M); rep(l, M) { int s = 0; for (int r=l; r<M; r++) { s += K[r]; if (s-count(K[l], K[r]) > 0) return 0; } } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...