Submission #230510

#TimeUsernameProblemLanguageResultExecution timeMemory
230510VimmerNLO (COCI18_nlo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //#pragma GCC optimize("unroll-loops") //#pragma GCC optimize("-O3") //#pragma GCC optimize("Ofast") //#pragma GCC optimize("fast-math") //#pragma GCC optimize("no-stack-protector") #define F first #define S second #define sz(x) int(x.size()) #define pb push_back #define N 100005 #define MOD ll(998244353) using namespace std; //using namespace __gnu_pbds; typedef long double ld; typedef long long ll; typedef short int si; //typedef tree <int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; bool gd(ll sx, ll sy, ll x, ll y, ll r) { ll rst = (sx - x) * (sx - x) + (sy - y) * (sy - y); return r * r >= rst; } int main() { // freopen("input.txt", "r", stdin);// freopen("output.txt", "w", stdout); ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n, m, k; cin >> n >> m >> k; ll ans = n * m * k; int sx[k], sy[k], R[k]; for (int i = 0; i < k; i++) cin >> sx[i] >> sy[i] >> R[i]; for (int x = 1; x <= n; x++) { vector <pair < int, pair <int, int> > > g; g.clear(); for (int j = 0; j < k; j++) { if (!gd(sx[j] sy[j], x, sy[j], R[j])) continue; int l = 1, r = sy[j]; while (l < r) { int md = (l + r) >> 1; if (gd(sx, sy, x, md, R[j])) r = md; else l = md + 1; } int L = l; l = sy[j], r = m; while (l + 1 < r) { int md = (l + r) >> 1; if (gd(sx, sy, x, md, R[j])) l = md; else r = md - 1; } while (!gd(sx, sy, x, l, R[j])) l--; while (gd(sx, sy, x, l + 1, R[j])) l++; int R = l; g.pb({i + 1, {L, R}}); } while (sz(g) > 0) { ll L = g.back().S.F, R = g.back().S.S; ll nm = g.back().F; g.pop_back(); ans -= nm * (R - L + 1); vector <pair <int, pair <int, int> > > vr; vr.clear(); for (auto it : g) { int l = it.S.F, r = it.S.S; if (L <= l && r <= R) continue; if (l <= L && R <= r) {vr.pb({it.F, {l, L - 1}}); vr.pb({it.F, {R + 1, r}});} if (r < L || R < l) {vr.pb(it); continue;} if (r < R) r = L - 1; else l = R + 1; vr.pb({it.F, {l, r}}); } g = vr; } } cout << ans << endl; }

Compilation message (stderr)

nlo.cpp: In function 'int main()':
nlo.cpp:59:27: error: expected ')' before 'sy'
             if (!gd(sx[j] sy[j], x, sy[j], R[j])) continue;
                           ^~
nlo.cpp:59:48: error: too few arguments to function 'bool gd(ll, ll, ll, ll, ll)'
             if (!gd(sx[j] sy[j], x, sy[j], R[j])) continue;
                                                ^
nlo.cpp:31:6: note: declared here
 bool gd(ll sx, ll sy, ll x, ll y, ll r)
      ^~
nlo.cpp:67:43: error: invalid conversion from 'int*' to 'll {aka long long int}' [-fpermissive]
                 if (gd(sx, sy, x, md, R[j])) r = md; else l = md + 1;
                                           ^
nlo.cpp:31:6: note:   initializing argument 1 of 'bool gd(ll, ll, ll, ll, ll)'
 bool gd(ll sx, ll sy, ll x, ll y, ll r)
      ^~
nlo.cpp:67:43: error: invalid conversion from 'int*' to 'll {aka long long int}' [-fpermissive]
                 if (gd(sx, sy, x, md, R[j])) r = md; else l = md + 1;
                                           ^
nlo.cpp:31:6: note:   initializing argument 2 of 'bool gd(ll, ll, ll, ll, ll)'
 bool gd(ll sx, ll sy, ll x, ll y, ll r)
      ^~
nlo.cpp:78:43: error: invalid conversion from 'int*' to 'll {aka long long int}' [-fpermissive]
                 if (gd(sx, sy, x, md, R[j])) l = md; else r = md - 1;
                                           ^
nlo.cpp:31:6: note:   initializing argument 1 of 'bool gd(ll, ll, ll, ll, ll)'
 bool gd(ll sx, ll sy, ll x, ll y, ll r)
      ^~
nlo.cpp:78:43: error: invalid conversion from 'int*' to 'll {aka long long int}' [-fpermissive]
                 if (gd(sx, sy, x, md, R[j])) l = md; else r = md - 1;
                                           ^
nlo.cpp:31:6: note:   initializing argument 2 of 'bool gd(ll, ll, ll, ll, ll)'
 bool gd(ll sx, ll sy, ll x, ll y, ll r)
      ^~
nlo.cpp:81:42: error: invalid conversion from 'int*' to 'll {aka long long int}' [-fpermissive]
             while (!gd(sx, sy, x, l, R[j])) l--;
                                          ^
nlo.cpp:31:6: note:   initializing argument 1 of 'bool gd(ll, ll, ll, ll, ll)'
 bool gd(ll sx, ll sy, ll x, ll y, ll r)
      ^~
nlo.cpp:81:42: error: invalid conversion from 'int*' to 'll {aka long long int}' [-fpermissive]
             while (!gd(sx, sy, x, l, R[j])) l--;
                                          ^
nlo.cpp:31:6: note:   initializing argument 2 of 'bool gd(ll, ll, ll, ll, ll)'
 bool gd(ll sx, ll sy, ll x, ll y, ll r)
      ^~
nlo.cpp:83:45: error: invalid conversion from 'int*' to 'll {aka long long int}' [-fpermissive]
             while (gd(sx, sy, x, l + 1, R[j])) l++;
                                             ^
nlo.cpp:31:6: note:   initializing argument 1 of 'bool gd(ll, ll, ll, ll, ll)'
 bool gd(ll sx, ll sy, ll x, ll y, ll r)
      ^~
nlo.cpp:83:45: error: invalid conversion from 'int*' to 'll {aka long long int}' [-fpermissive]
             while (gd(sx, sy, x, l + 1, R[j])) l++;
                                             ^
nlo.cpp:31:6: note:   initializing argument 2 of 'bool gd(ll, ll, ll, ll, ll)'
 bool gd(ll sx, ll sy, ll x, ll y, ll r)
      ^~
nlo.cpp:87:19: error: 'i' was not declared in this scope
             g.pb({i + 1, {L, R}});
                   ^
nlo.cpp:87:33: error: no matching function for call to 'std::vector<std::pair<int, std::pair<int, int> > >::push_back(<brace-enclosed initializer list>)'
             g.pb({i + 1, {L, R}});
                                 ^
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from nlo.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:939:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, std::pair<int, int> > >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, std::pair<int, int> >]
       push_back(const value_type& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:939:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, std::pair<int, int> >&}'
/usr/include/c++/7/bits/stl_vector.h:953:7: note: candidate: void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, std::pair<int, int> > >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, std::pair<int, int> >]
       push_back(value_type&& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:953:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, std::pair<int, int> > >::value_type&& {aka std::pair<int, std::pair<int, int> >&&}'