Submission #347737

#TimeUsernameProblemLanguageResultExecution timeMemory
347737mkisic새로운 문제 (POI11_met)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define breturn return #define ll long long using namespace std; const int maxn = 300001; ll n, m, o[maxn], p[maxn], a, b, c, q, bn, tour[1048600], laz[1048600], ans[maxn]; vector<pair<ll, pair<ll, ll> > > midl[maxn], quer; vector<pair<ll, pair<ll, pair<ll, ll> > > > nx; vector<ll> v[maxn]; bool done; void upd(ll ax, ll bx, ll val, ll x = 1, ll l = 0, ll r = bn - 1) { if(ax > r or bx < l) breturn; if(l >= ax and r <= bx) { laz[x] += val; breturn; } ll mid = (l + r)/2; upd(ax, bx, val, x * 2, l, mid); upd(ax, bx, val, x * 2 + 1, mid + 1, r); } ll query(ll ax, ll bx, ll x = 1, ll l = 0, ll r = bn - 1) { if(ax > r or bx < l) breturn 0;; if(l >= ax and r <= bx) { tour[x] += laz[x]; laz[x] = 0; breturn tour[x]; } laz[x * 2] += laz[x]; laz[x * 2 + 1] += laz[x]; laz[x] = 0; ll mid = (l + r)/2; breturn query(ax, bx, x * 2, l, mid) + query(ax, bx, x * 2 + 1, mid + 1, r); } #define getchar_macro() getchar_unlocked() void scanint(int &x) { register int c = getchar_macro(); x = 0; for(;(c<48 || c>57);c = getchar_macro()); for(;c>47 && c<58;c = getchar_macro()) {x = (x<<1) + (x<<3) + c - 48;} } int main() { scanint(n); scanint(m); for(int i = 0; i < m; i++ ) scanint(a), v[a - 1].push_back(i); for(ll i = 0; i < n; i++) scanint(p[i]); scanint(q); bn = (1 << ((ll)log2(m - 1 + (m == 1)) + 1)); for(ll i = 0; i < q; i++) { scanint(a); scanint(b); scanint(c); quer.push_back({c, {a - 1, b - 1}}); } for(ll i = 0; i < n; i++) midl[(int)(q/2)].push_back({i, {0, q}}); while(!done) { for(ll i = 0; i < 2 * bn; i++) tour[i] = 0, laz[i] = 0; for(ll i = 0; i < q; i++) { if(quer[i].second.first > quer[i].second.second) { upd(0, quer[i].second.second, quer[i].first); upd(quer[i].second.first, m - 1, quer[i].first); } else upd(quer[i].second.first, quer[i].second.second, quer[i].first); for(ll j = 0; j < midl[i].size(); j++) { ll y = midl[i][j].first; unsigned ll x = 0; for(ll k = 0; k < v[y].size(); k++) { x += query(v[y][k], v[y][k]); if(x >= 1e9) break; } ll le = midl[i][j].second.first; ll re = midl[i][j].second.second; ll mid = (le + re)/2; if(x < p[y]) le = mid + 1; else re = mid; mid = (le + re)/2; if(le == re) ans[y] = le; else nx.push_back({mid, {y, {le, re}}}); } midl[i].clear(); midl[i].shrink_to_fit(); } done = !(nx.size()); for(ll j = 0; j < nx.size(); j++) midl[nx[j].first].push_back(nx[j].second); nx.clear(); nx.shrink_to_fit(); } for(ll i = 0; i < n; i++) { if(ans[i] == q) cout << "NIE\n"; else cout << ans[i] + 1 << '\n'; } }

Compilation message (stderr)

met.cpp: In function 'int main()':
met.cpp:46:10: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   46 |  scanint(n); scanint(m);
      |          ^
met.cpp:37:19: note:   initializing argument 1 of 'void scanint(int&)'
   37 | void scanint(int &x)
      |              ~~~~~^
met.cpp:46:22: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   46 |  scanint(n); scanint(m);
      |                      ^
met.cpp:37:19: note:   initializing argument 1 of 'void scanint(int&)'
   37 | void scanint(int &x)
      |              ~~~~~^
met.cpp:47:38: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   47 |  for(int i = 0; i < m; i++ ) scanint(a), v[a - 1].push_back(i);
      |                                      ^
met.cpp:37:19: note:   initializing argument 1 of 'void scanint(int&)'
   37 | void scanint(int &x)
      |              ~~~~~^
met.cpp:48:39: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   48 |  for(ll i = 0; i < n; i++) scanint(p[i]);
      |                                    ~~~^
met.cpp:37:19: note:   initializing argument 1 of 'void scanint(int&)'
   37 | void scanint(int &x)
      |              ~~~~~^
met.cpp:49:10: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   49 |  scanint(q);
      |          ^
met.cpp:37:19: note:   initializing argument 1 of 'void scanint(int&)'
   37 | void scanint(int &x)
      |              ~~~~~^
met.cpp:52:11: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   52 |   scanint(a);
      |           ^
met.cpp:37:19: note:   initializing argument 1 of 'void scanint(int&)'
   37 | void scanint(int &x)
      |              ~~~~~^
met.cpp:53:15: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   53 |       scanint(b);
      |               ^
met.cpp:37:19: note:   initializing argument 1 of 'void scanint(int&)'
   37 | void scanint(int &x)
      |              ~~~~~^
met.cpp:54:15: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   54 |       scanint(c);
      |               ^
met.cpp:37:19: note:   initializing argument 1 of 'void scanint(int&)'
   37 | void scanint(int &x)
      |              ~~~~~^
met.cpp:65:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |    for(ll j = 0; j < midl[i].size(); j++) {
      |                  ~~^~~~~~~~~~~~~~~~
met.cpp:68:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |     for(ll k = 0; k < v[y].size(); k++) {
      |                   ~~^~~~~~~~~~~~~
met.cpp:75:10: warning: comparison of integer expressions of different signedness: 'long long unsigned int' and 'long long int' [-Wsign-compare]
   75 |     if(x < p[y]) le = mid + 1;
      |        ~~^~~~~~
met.cpp:85:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, std::pair<long long int, long long int> > > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   85 |   for(ll j = 0; j < nx.size(); j++) midl[nx[j].first].push_back(nx[j].second);
      |                 ~~^~~~~~~~~~~