제출 #360984

#제출 시각아이디문제언어결과실행 시간메모리
360984beksultan04모임들 (IOI18_meetings)C++14
0 / 100
44 ms1900 KiB
#include "meetings.h" #ifndef EVAL #include "grader.cpp" #endif // EVAL #include <bits/stdc++.h> using namespace std; #define lol long long #define pii pair<int,int> #define OK puts("OK"); #define NO puts("NO"); #define YES puts("YES"); #define fr first #define sc second #define ret return #define scanl(a) scanf("%lld",&a); #define scanll(a,b) scanf("%lld %lld",&a, &b); #define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c); #define scan1(a) scanf("%d",&a); #define scan2(a,b) scanf("%d %d",&a, &b); #define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c); #define all(s) s.begin(),s.end() #define allr(s) s.rbegin(),s.rend() #define pb push_back #define sz(v) (int)v.size() #define endi puts(""); #define eps 1e-12 lol dis[1001001],mx[1001001],q[1001001]; struct node{ int ans,pref,suff; }der[1001001]; node merg(node a,node b){ node ans ; ans.pref = a.pref; ans.suff = b.suff; ans.ans = max(a.suff+b.pref,max(a.ans,b.ans)); ret ans; } void build(int v,int l,int r){ if (l == r){ der[v].pref = (q[l] == 1); der[v].suff = (q[l] == 1); der[v].ans = (q[l] == 1); } else { int m = l+r>>1; build(v<<1,l,m); build((v<<1)+1,m+1,r); der[v] = merg(der[v<<1],der[(v<<1)+1]); } } node getLR(int v,int l,int r,int ql,int qr){ node ans; ans.ans = 0; ans.pref = 0; ans.suff = 0; if (l > qr || r < ql)ret ans; if (ql <= l && r <= qr)ret der[v]; else { int m = l+r>>1; ans = merg(getLR(v<<1,l,m,ql,qr),getLR((v<<1)+1,m+1,r,ql,qr)); ret ans; } } vector<lol> minimum_costs(vector<int> H, vector<int> L,vector<int> R) { int i,j,k,n = H.size(),Q = L.size(); vector<lol> C(Q); for (i=0;i<n;++i)q[i] = H[i]; build(1,0,n-1); for (i=0;i<Q;++i){ node x = getLR(1,0,n-1,L[i],R[i]); C[i] = ((R[i]-L[i]+1)*2 - x.ans); } ret C; }

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

meetings.cpp: In function 'void build(int, int, int)':
meetings.cpp:49:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   49 |         int m = l+r>>1;
      |                 ~^~
meetings.cpp: In function 'node getLR(int, int, int, int, int)':
meetings.cpp:64:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   64 |         int m = l+r>>1;
      |                 ~^~
meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:72:11: warning: unused variable 'j' [-Wunused-variable]
   72 |     int i,j,k,n = H.size(),Q = L.size();
      |           ^
meetings.cpp:72:13: warning: unused variable 'k' [-Wunused-variable]
   72 |     int i,j,k,n = H.size(),Q = L.size();
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...