제출 #846286

#제출 시각아이디문제언어결과실행 시간메모리
846286vjudge1OGLEDALA (COI15_ogledala)C++17
0 / 100
2973 ms524288 KiB
/* Author : Mychecksdead */ #include<bits/stdc++.h> using namespace std; #define ll long long int #define MOD (1000000000+7) #define MOD1 (998244353) #define pb push_back #define all(x) x.begin(), x.end() #define en cout << '\n' const int N = 1e6+100, M = 1e5+10, K = 18; ll m, n, q, a[N], c[N]; void calc(ll n){ } void solve(){ cin >> m >> n >> q; a[0] = 0, a[n+1] = m + 1; for(int i = 1; i <= n; ++i) cin >> a[i]; int cur = 1; set<array<ll, 3>> seg; for(int i = 1; i <= n + 1; ++i){ if(a[i] - a[i - 1] - 1 > 0){ c[cur] = a[i] - a[i - 1] - 1; seg.insert({c[cur], -(a[i-1]+1), a[i]-1}); ++cur; } } ll x = 0; for(int i = 1; i <= q; ++i){ ll b; cin >> b; while(x < b-n-1){ auto it = prev(seg.end()); ll l = -(*it)[1], r = (*it)[2]; seg.erase(it); seg.insert({(r-l)/2, -l, l+(r-l)/2-1}); seg.insert({(r-l+1)/2, -(l+(r-l)/2+1), r}); ++x; } auto it = prev(seg.end()); ll l = -(*it)[1], r = (*it)[2]; cout << (l+r)/2 << '\n'; // for(auto f: seg){ // cout << f[0] << ' ' << f[1] << ' ' << f[2] << '\n'; // } // en; } } int main(){ cin.tie(0); ios::sync_with_stdio(0); int tt = 1, aa; // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); // cin >> tt; while(tt--){ solve(); en; } cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" seconds\n"; return 0; }

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

ogledala.cpp: In function 'int main()':
ogledala.cpp:56:15: warning: unused variable 'aa' [-Wunused-variable]
   56 |   int tt = 1, aa;
      |               ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...