제출 #120454

#제출 시각아이디문제언어결과실행 시간메모리
120454someone_aa팀들 (IOI15_teams)C++17
21 / 100
35 ms8368 KiB
#include <bits/stdc++.h> #include "teams.h" #define P pair<int,int> #define pb push_back #define ll long long #define mp make_pair using namespace std; const int maxn = 110; // WARNING SMALL N int n; vector<P>intervals; int cnt[maxn][maxn], used[maxn]; class node { public: int sum; node *leftchild, *rightchild; node(int _sum) { sum = _sum; leftchild = rightchild = NULL; } node(node *a, node *b) { sum = a->sum + b->sum; leftchild = a; rightchild = b; } }; node *build(int li=1, int ri=n) { if(li == ri) return new node(0); else { int mid = (li + ri) / 2; return new node(build(li, mid), build(mid+1, ri)); } } node* insert_number(node *curr, int position, int val, int li=1, int ri=n) { if(li == ri) { curr->sum += val; return curr; } else { int mid = (li + ri) / 2; if(position <= mid) return new node(insert_number(curr->leftchild, position, val, li, mid), curr->rightchild); else return new node(curr->leftchild, insert_number(curr->rightchild, position, val, mid+1, ri)); } } void init(int N, int A[], int B[]) { n = N; for(int i=1;i<=n;i++) { for(int j=0;j<n;j++) { if(i >= A[j] && i <= B[j]) { cnt[i][B[j]]++; } } } } int can(int M, int K[]) { memset(used,0,sizeof(used)); sort(K, K + M); int marked = 0; for(int i=0;i<M;i++) { marked = 0; for(int j=1;j<=n;j++) { if(cnt[K[i]][j] <= used[j]) continue; int diff = cnt[K[i]][j] - used[j]; diff = min(diff, K[i] - marked); used[j] += diff; marked += diff; if(marked == K[i]) break; } if(marked != K[i]) return false; } return true; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...