Submission #1310123

#TimeUsernameProblemLanguageResultExecution timeMemory
1310123mohammadyay사육제 (CEOI14_carnival)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> //#define endl '\n' using ll = long long; #define pb push_back #define pF first #define pS second #define SP <<' '<< #define all(x) (x).begin(), (x).end() const ll mod7 = 1e9+7, mod9= 998244353, MAX_N = 10000000; //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); ll link[300], col[300]; ll query(ll n, ll l, ll r) { cout << r-l+2 << " "; cout << n << " "; for (int i=l; i<r; i++) { cout << i << " "; } cout << r << endl; ll x; cin>>x; return x; } ll query(ll l, ll r) { cout << r-l+1 << " "; for (int i=l; i<r; i++) { cout << i << " "; } cout << r << endl; ll x; cin>>x; return x; } int main() { //ios::sync_with_stdio(0); cin.tie(NULL); ll n; cin>>n; for (int i=1; i<=n; i++) { ll l = i+1, r = n; while (l <= r) { ll mi = (l+r)/2; bool equal = 0; if (query(l , mi) == query(i, l, mi)) equal = 1; if (equal) { if (l == r) { link[i] = l; break; } r = mi; } else l = mi+1; } } vector<bool> vis(n+1, 0); ll color = 1; for (int i=1; i<=n; i++) { if (vis[i]) continue; ll x = i; while (x != 0) { col[x] = color; vis[x] = 1; x = link[x]; } color++; } cout << 0 << " "; for (int i=1; i<n; i++) { cout << col[i] << " "; } cout << col[n] << endl; }

Compilation message (stderr)

carnival.cpp:16:12: error: 'll link [300]' redeclared as different kind of entity
   16 | ll link[300], col[300];
      |            ^
In file included from /usr/include/c++/13/bits/atomic_wait.h:45,
                 from /usr/include/c++/13/bits/atomic_base.h:42,
                 from /usr/include/c++/13/bits/shared_ptr_atomic.h:33,
                 from /usr/include/c++/13/memory:81,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:56,
                 from carnival.cpp:1:
/usr/include/unistd.h:819:12: note: previous declaration 'int link(const char*, const char*)'
  819 | extern int link (const char *__from, const char *__to)
      |            ^~~~
carnival.cpp: In function 'int main()':
carnival.cpp:46:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |                     link[i] = l;
      |                           ^
carnival.cpp:46:29: error: assignment of read-only location '*(link + ((sizetype)i))'
   46 |                     link[i] = l;
      |                     ~~~~~~~~^~~
carnival.cpp:62:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   62 |             x = link[x];
      |                       ^
carnival.cpp:62:23: error: invalid conversion from 'int (*)(const char*, const char*) noexcept' to 'll' {aka 'long long int'} [-fpermissive]
   62 |             x = link[x];
      |                 ~~~~~~^
      |                       |
      |                       int (*)(const char*, const char*) noexcept