Submission #1034049

#TimeUsernameProblemLanguageResultExecution timeMemory
1034049AntekbIsland Hopping (JOI24_island)C++17
65 / 100
8 ms856 KiB
#include "bits/stdc++.h" /** keep-include */ using namespace std; #define rep(i, b, e) for(int i = (b); i <= (e); i++) #define per(i, b, e) for(int i = (e); i >= (b); i--) #define FOR(i, b, e) rep(i, b, (e) - 1) #define SZ(x) int(x.size()) #define all(x) x.begin(), x.end() #define pb push_back #define mp make_pair #define st first #define nd second using ll = long long; using vi = vector<int>; using pii = pair<int, int>; auto &operator<<(auto &o, pair<auto, auto> p) { return o << "(" << p.st << ", " << p.nd << ")"; } auto operator<<(auto &o, auto x)->decltype(end(x), o) { o << "{"; int i=0; for(auto e: x) o << ", " + 2*!i++ << e; return o << "}"; } #ifdef LOCAL #define deb(x...) cerr << "[" #x "]: ", [](auto...$) { \ ((cerr << $ << "; "),...) << endl; }(x) #else #define deb(...) #endif #include "island.h" const int N=305; int r[N]; int find(int v){ if(r[v]==v)return v; return find(r[v]); } void Union(int a, int b){ a=find(a); b=find(b); r[a]=b; } map<pair<int, int>, int > M; int query2(int v, int d){ if(M.find(mp(v, d))!=M.end()){ return M[mp(v, d)]; } int ans=query(v, d); M[mp(v, d)]=ans; return ans; } void solve(int n, int L) { vector<vector<int> > edg(n+1); for(int i=1; i<=n; i++){ r[i]=i; } for(int v=1; v<=n; v++){ while(edg[v].size()<n-1){ int u = query2(v, edg[v].size()+1); if(find(u)==find(v))break; if(edg[v].size() && u<edg[v].back())break; if(edg[v].size()){ int w=query2(u, edg[u].size()+1); if(w!=v)break; } edg[u].pb(v); edg[v].pb(u); Union(u, v); answer(u, v); } } /*int variable_example = query(1, 1); for (int i = 2; i <= n; i++) { answer(1, i); }*/ }

Compilation message (stderr)

island.cpp:17:18: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   17 | auto &operator<<(auto &o, pair<auto, auto> p) {
      |                  ^~~~
island.cpp:17:32: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   17 | auto &operator<<(auto &o, pair<auto, auto> p) {
      |                                ^~~~
island.cpp:17:38: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   17 | auto &operator<<(auto &o, pair<auto, auto> p) {
      |                                      ^~~~
island.cpp:19:17: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | auto operator<<(auto &o, auto x)->decltype(end(x), o) {
      |                 ^~~~
island.cpp:19:26: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | auto operator<<(auto &o, auto x)->decltype(end(x), o) {
      |                          ^~~~
island.cpp: In function 'void solve(int, int)':
island.cpp:58:28: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   58 |         while(edg[v].size()<n-1){
      |               ~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...