답안 #780363

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
780363 2023-07-12T08:31:12 Z fatemetmhr 곤돌라 (IOI14_gondola) C++17
10 / 100
9 ms 1232 KB
//  ~ Be Name Khoda ~  //

#include "gondola.h"
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")

using namespace std;

typedef long long ll;

#define pb       push_back
#define mp       make_pair
#define all(x)   x.begin(), x.end()
#define fi       first
#define se       second

const int maxn  =  1e6   + 10;
const int maxn5 =  5e5   + 10;
const int maxnt =  1.2e6 + 10;
const int maxn3 =  1e3   + 10;
const int mod   =  1e9   + 7;
const ll  inf   =  1e18;

vector <int> av;


int valid(int n, int inputSeq[])
{
    for(int i =0 ; i < n; i++)
        inputSeq[i]--;
    for(int i = 0; i < n; i++) if(inputSeq[i] < n)
        av.pb(i);
    int mnid = 0;
    if(av.empty())
        return 1;
    for(int i = 0; i < av.size(); i++) if(inputSeq[av[i]] < inputSeq[av[mnid]])
        mnid = i;
    int keep = mnid;
    //cout << av.size() << endl;
    for(int i = 0; i < av.size(); i++){
        int nxt = mnid + 1;
        if(nxt == av.size())
            nxt = 0;
        int u = av[mnid], v = av[nxt];
        //cout << "here " << mnid << ' ' << nxt << ' ' << u << ' ' << v << endl;
        if((nxt != keep && inputSeq[u] > inputSeq[v]) || (n + inputSeq[v] - inputSeq[u]) % n != (v - u + n) % n)
            return 0;
        mnid = nxt;
    }
    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:38:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for(int i = 0; i < av.size(); i++) if(inputSeq[av[i]] < inputSeq[av[mnid]])
      |                    ~~^~~~~~~~~~~
gondola.cpp:42:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for(int i = 0; i < av.size(); i++){
      |                    ~~^~~~~~~~~~~
gondola.cpp:44:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         if(nxt == av.size())
      |            ~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 4 ms 852 KB Output is correct
7 Correct 8 ms 1232 KB Output is correct
8 Correct 7 ms 1232 KB Output is correct
9 Correct 3 ms 596 KB Output is correct
10 Correct 9 ms 1232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 4 ms 852 KB Output is correct
7 Correct 8 ms 1232 KB Output is correct
8 Correct 8 ms 1232 KB Output is correct
9 Correct 3 ms 596 KB Output is correct
10 Correct 9 ms 1228 KB Output is correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -