제출 #1220519

#제출 시각아이디문제언어결과실행 시간메모리
1220519moha1111쌀 창고 (IOI11_ricehub)C++20
컴파일 에러
0 ms0 KiB
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") #include "ricehub.h" #include <cstdio> #include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> #define all(a) a.begin() , a.end() const long long mod = 1000000007; using namespace std; using namespace __gnu_pbds; typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>indexed_multiset; long long int besthub(long long R, long long L, int X[], long long B) { long long st = 1 , en = R , ans; while(st <= en) { long long mid = (st + en) / 2; indexed_multiset cur; for(int i = 0 ; i < mid ; i++) cur.insert(a[i]); if(mid % 2 == 0) { if(*cur.find_by_order(mid / 2) <= B) { st = mid + 1 , ans = mid; continue; } for(int i = mid ; i < r ; i++) { cur.insert(a[mid]); cur.erase(cur.find(a[i - mid])); if(*cur.find_by_order(mid / 2) <= B) { st = mid + 1 , ans = mid; continue; } } en = mid - 1; } else { if(*cur.find_by_order(mid / 2) + *cur.find_by_order(mid / 2 + 1)<= B * 2) { st = mid + 1 , ans = mid; continue; } for(int i = mid ; i < r ; i++) { cur.insert(a[mid]); cur.erase(cur.find(a[i - mid])); if(*cur.find_by_order(mid / 2) + *cur.find_by_order(mid / 2 + 1)<= B * 2) { st = mid + 1 , ans = mid; continue; } } en = mid - 1; } } cout << ans << '\n'; }

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

ricehub.cpp: In function 'long long int besthub(long long int, long long int, int*, long long int)':
ricehub.cpp:23:24: error: 'a' was not declared in this scope
   23 |             cur.insert(a[i]);
      |                        ^
ricehub.cpp:32:35: error: 'r' was not declared in this scope
   32 |             for(int i = mid ; i < r ; i++)
      |                                   ^
ricehub.cpp:34:28: error: 'a' was not declared in this scope
   34 |                 cur.insert(a[mid]);
      |                            ^
ricehub.cpp:51:35: error: 'r' was not declared in this scope
   51 |             for(int i = mid ; i < r ; i++)
      |                                   ^
ricehub.cpp:53:28: error: 'a' was not declared in this scope
   53 |                 cur.insert(a[mid]);
      |                            ^
ricehub.cpp:65:1: warning: no return statement in function returning non-void [-Wreturn-type]
   65 | }
      | ^