# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
819156 | 2023-08-10T08:14:44 Z | andecaandeci | Gondola (IOI14_gondola) | C++17 | 19 ms | 5008 KB |
#include "gondola.h" #include <bits/stdc++.h> using namespace std; using pii=pair<int,int>; #define SETIO cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false); #define fi first #define se second #define pb push_back #define SORT(v) sort(begin(v),end(v)) #define REV(v) reverse(begin(v),end(v)) #define FORI(v) for(auto i:v) #define REP(i,o,n) for(int i=o;i<n;i++) #define int long long const int mod = 1e9+7; #undef int int valid(int n, int inputSeq[]) #define int long long { set<int> st; int cur=-1; REP(i,0,n) { st.insert(inputSeq[i]); if(inputSeq[i]<=n){ if(cur!=-1)if(cur!=inputSeq[i])return 0; cur=inputSeq[i]; } if(cur!=-1)cur++; if(cur==n+1)cur=1; } if(st.size()!=n)return 0; return 1; } //---------------------- #undef int int replacement(int n, int gondolaSeq[], int replacementSeq[]) #define int long long { return -2; } //---------------------- #undef int int countReplacement(int n, int inputSeq[]) #define int long long { if(!valid(n, inputSeq))return 0; vector<int> overs; REP(i,0,n){ int q=inputSeq[i]; if(q>n)overs.pb(q); } SORT(overs); REV(overs); int cur=n; int ans=1; if(overs.size()==n)REP(i,1,n)ans*=(i+1),ans%=mod; while(overs.size()){ cur++; if(cur==overs.back()){overs.pop_back();continue;} ans*=overs.size(); ans%=mod; } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 304 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 300 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 8 ms | 2328 KB | Output is correct |
7 | Correct | 7 ms | 1084 KB | Output is correct |
8 | Correct | 15 ms | 4348 KB | Output is correct |
9 | Correct | 5 ms | 1492 KB | Output is correct |
10 | Correct | 18 ms | 4928 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 304 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 8 ms | 2384 KB | Output is correct |
7 | Correct | 8 ms | 1104 KB | Output is correct |
8 | Correct | 16 ms | 4276 KB | Output is correct |
9 | Correct | 5 ms | 1584 KB | Output is correct |
10 | Correct | 19 ms | 5008 KB | Output is correct |
11 | Correct | 0 ms | 308 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 3 ms | 596 KB | Output is correct |
14 | Correct | 1 ms | 308 KB | Output is correct |
15 | Correct | 7 ms | 1108 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 304 KB | Integer -2 violates the range [0, 350000] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Integer -2 violates the range [0, 350000] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 308 KB | Integer -2 violates the range [0, 350000] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 304 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 304 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 304 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Incorrect | 0 ms | 212 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 308 KB | Output is correct |
7 | Incorrect | 1 ms | 340 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 304 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Incorrect | 0 ms | 212 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |