Submission #536984

# Submission time Handle Problem Language Result Execution time Memory
536984 2022-03-14T08:38:23 Z Spade1 Gondola (IOI14_gondola) C++14
20 / 100
13 ms 1108 KB
#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;

int valid(int n, int inputSeq[]) {
    int _min = INT_MAX, idx;
    for (int i = 0; i < n; ++i) {
        if (inputSeq[i] < _min) {
            _min = inputSeq[i];
            idx = i;
        }
    }
    for (int i = idx; i < idx + n; ++i) {
        if (inputSeq[(i%n)] != i - idx + 1 && inputSeq[(i%n)] <= n) return 0;
    }

    sort (inputSeq, inputSeq + n);
    for (int i = 1; i < n; ++i) {
        if (inputSeq[i] == inputSeq[i - 1]) return 0;
    }

    return 1;
}

int replacement(int n, int gondolaSeq[], int replacementSeq[]) {

}

int countReplacement(int n, int inputSeq[]) {

}
//
//int nseq[200020];
//
//int main() {
//    ios_base::sync_with_stdio(0); cin.tie(NULL);
//    int n; cin >> n;
//    for (int i = 0; i < n; ++i) {
//        cin >> nseq[i];
//    }
//    cout << valid(n, nseq);
//}

Compilation message

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:27:1: warning: no return statement in function returning non-void [-Wreturn-type]
   27 | }
      | ^
gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:31:1: warning: no return statement in function returning non-void [-Wreturn-type]
   31 | }
      | ^
gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:14:24: warning: 'idx' may be used uninitialized in this function [-Wmaybe-uninitialized]
   14 |         if (inputSeq[(i%n)] != i - idx + 1 && inputSeq[(i%n)] <= n) return 0;
      |                      ~~^~~
# 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 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 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 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 7 ms 340 KB Output is correct
7 Correct 12 ms 604 KB Output is correct
8 Correct 10 ms 468 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 13 ms 620 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 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 6 ms 340 KB Output is correct
7 Correct 12 ms 596 KB Output is correct
8 Correct 9 ms 596 KB Output is correct
9 Correct 4 ms 396 KB Output is correct
10 Correct 13 ms 596 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 308 KB Output is correct
13 Correct 4 ms 620 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 7 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 412 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -