Submission #793846

# Submission time Handle Problem Language Result Execution time Memory
793846 2023-07-26T07:24:24 Z Ronin13 Gondola (IOI14_gondola) C++17
20 / 100
35 ms 5680 KB
#include "gondola.h"
#include <bits/stdc++.h>
#define ll long long 
#define ull unsigned ll
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define epb emplace_back
using namespace std;

int valid(int n, int a[]){
    vector <pii> vv;
    set <int> st;
    for(int i = 0; i < n; i++){
      if(st.find(a[i]) != st.end())
        return 0;
      st.insert(a[i]);
        if(a[i] <= n)
          vv.pb({a[i], i});
    }
    sort(vv.begin(), vv.end());
    for(int i = 1; i < vv.size(); i++){
      int x = vv[i].s, y = vv[i - 1].s;
      int dist = vv[i].f - vv[i - 1].f;
      if((x - y + n) % n != dist)
        return 0;
    }
    return 1;
}

//----------------------

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
  return -2;
}

//----------------------

int countReplacement(int n, int inputSeq[])
{
  return -3;
}

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i = 1; i < vv.size(); i++){
      |                    ~~^~~~~~~~~~~
# 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 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 312 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 12 ms 2640 KB Output is correct
7 Correct 7 ms 1188 KB Output is correct
8 Correct 21 ms 5048 KB Output is correct
9 Correct 8 ms 1696 KB Output is correct
10 Correct 29 ms 5580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 12 ms 2632 KB Output is correct
7 Correct 7 ms 1196 KB Output is correct
8 Correct 21 ms 5012 KB Output is correct
9 Correct 7 ms 1724 KB Output is correct
10 Correct 29 ms 5596 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 11 ms 2260 KB Output is correct
14 Correct 0 ms 304 KB Output is correct
15 Correct 35 ms 5680 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 1 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 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 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -