Submission #762089

#TimeUsernameProblemLanguageResultExecution timeMemory
762089coloboxxGondola (IOI14_gondola)C++17
20 / 100
15 ms5860 KiB
// #pragma GCC optimize("Ofast") // #pragma GCC optimize("unroll-loops") // #pragma GCC target("avx,avx2,sse2,sse3,ssse3,sse4,lzcnt,popcnt") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define ll long long #define point pair<int, int> #define X first #define Y second #define all(x) (x).begin(), (x).end() #define pb push_back #define show(x) cerr << (#x) << " = " << x << '\n' #define print(x) if (1) {cerr << (#x) << " = "; for (auto it : x) \ cerr << it << ' '; cerr << '\n';} #define fast_io ios_base::sync_with_stdio(0), cin.tie(0) const int N = 1 << 19; const int S = 1e7 + 64; const int INF = 2e9 + 64; const ll MAX = 2e18 + 64; const int LOG = 21; const int MOD = 1e9 + 7; //998244353; const int P = 79; using namespace std; #include "gondola.h" int f = -1; int valid(int n, int a[]) { unordered_set<int> st; for (int i = 0; i < n; ++i) st.insert(a[i]); for (int i = 0; i < n; ++i) { if (a[i] <= n) { f = (n - a[i] % n + 1) % n; break; } } if (st.size() < n) return 0; if (f == -1) return 1; for (int i = 0; i < n; ++i) if (a[i] <= n && a[i] != (i - f + n) % n + 1) return 0; return 1; } int replacement(int n, int a[], int res[]) { if (!valid(n, a)) return 0; if (f == -1) f = 0; vector<int> ans(N); for (int i = 0; i < n; ++i) if (a[i] > n) ans[a[i]] = (i - f + n) % n + 1; int len = 0; for (int i = 0; i < N; ++i) if (ans[i]) res[len] = ans[i], ++len; return len; } int countReplacement(int n, int a[]) { return 0; }

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:46:21: warning: comparison of integer expressions of different signedness: 'std::unordered_set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   46 |       if (st.size() < n)
      |           ~~~~~~~~~~^~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...