제출 #1016505

#제출 시각아이디문제언어결과실행 시간메모리
1016505Muhammet팀들 (IOI15_teams)C++17
0 / 100
878 ms71572 KiB
#include <bits/stdc++.h> #include "teams.h" using namespace std; #define ff first #define ss second int n, an; vector <int> st, lz, st1, lz1; vector <pair<int,int>> a; int upd(int nd, int l, int r, int x, int y, int vl){ st[nd] += ((r-l+1) * lz[nd]); lz[nd*2] += lz[nd]; lz[nd*2+1] += lz[nd]; lz[nd] = 0; if(l > y or r < x) return st[nd]; if(l >= x and r <= y){ lz[nd] += vl; st[nd] += ((r-l+1) * lz[nd]); lz[nd*2] += lz[nd]; lz[nd*2+1] += lz[nd]; lz[nd] = 0; return st[nd]; } int md = (l + r) / 2; return st[nd] = upd(nd*2,l,md,x,y,vl) + upd(nd*2+1,md+1,r,x,y,vl); } int fnd(int nd, int l, int r, int ind){ st[nd] += ((r-l+1) * lz[nd]); lz[nd*2] += lz[nd]; lz[nd*2+1] += lz[nd]; lz[nd] = 0; if((r < ind) or (l > ind)) return st[nd]; if(l == r){ an = st[nd]; return st[nd]; } int md = (l + r) / 2; return st[nd] = fnd(nd*2,l,md,ind) + fnd(nd*2+1,md+1,r,ind); } void init(int N, int A[], int B[]) { n = N; a.resize(n); st.resize(n*8); lz.resize(n*8); for(int i = 0; i < n; i++){ a[i] = {A[i],B[i]}; upd(1,1,n,a[i].ff,a[i].ss,1); swap(a[i].ff,a[i].ss); } sort(a.begin(),a.end()); for(int i = 0; i < n; i++){ swap(a[i].ff, a[i].ss); } return; } int can(int m, int k[]) { sort(k,k+m); lz1 = lz; st1 = st; int ind = 0; for(int i = 0; i < m; i++){ an = 0; fnd(1,1,n,k[i]); if(an >= k[i]){ int cnt = 0; for(int j = ind; j < n; j++){ if(a[j].ff <= k[i] and a[j].ss >= k[i]){ cnt++; upd(1,1,n,a[j].ff,a[j].ss,-1); } if(cnt == k[i]) ind = j+1; break; } } else { st = st1; lz = lz1; return 0; } } st = st1; lz = lz1; return 1; }

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:79:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   79 |     if(cnt == k[i]) ind = j+1; break;
      |     ^~
teams.cpp:79:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   79 |     if(cnt == k[i]) ind = j+1; break;
      |                                ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...