# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
589278 | yutabi | Gondola (IOI14_gondola) | C++14 | 29 ms | 4572 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
typedef pair <int,int> ii;
int valid(int n, int s[])
{
set <int> st;
int diff=-1;
bool flag=0;
for(int i=0;i<n;i++)
{
st.insert(s[i]);
if(s[i]<=n)
{
int num=(s[i]+n-i)%n;
if(diff!=-1 && diff!=num)
{
flag=1;
}
diff=num;
}
}
if(st.size()!=n)
{
flag=1;
}
if(flag)
{
return 0;
}
return 1;
}
//----------------------
int replacement(int n, int ss[], int res[])
{
vector <ii> s;
int diff=0;
for(int i=0;i<n;i++)
{
if(ss[i]<=n)
{
diff=(ss[i]+n-i-1)%n;
}
else
{
s.pb(ii(ss[i],i));
}
}
sort(s.begin(),s.end());
int ans=0;
int curr=n;
for(int i=0;i<s.size();i++)
{
res[ans]=((s[i].second+diff)%n)+1;
ans++;
curr++;
while(curr<s[i].first)
{
res[ans]=curr;
ans++;
curr++;
}
}
return ans;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |