Submission #955862

# Submission time Handle Problem Language Result Execution time Memory
955862 2024-03-31T15:41:00 Z steveonalex Gondola (IOI14_gondola) C++17
20 / 100
12 ms 1628 KB
#include <bits/stdc++.h>
#include "gondola.h"
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define MASK(i) (1ULL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
#define ALL(v) (v).begin(), (v).end()
 
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
 
ll LASTBIT(ll mask){return (mask) & (-mask);}
int pop_cnt(ll mask){return __builtin_popcountll(mask);}
int ctz(ull mask){return __builtin_ctzll(mask);}
int logOf(ull mask){return 63 - __builtin_clzll(mask);}
 
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);}
 
template <class T1, class T2>
    bool maximize(T1 &a, T2 b){
        if (a < b) {a = b; return true;}
        return false;
    }
 
template <class T1, class T2>
    bool minimize(T1 &a, T2 b){
        if (a > b) {a = b; return true;}
        return false;
    }
 
template <class T>
    void printArr(T& container, string separator = " ", string finish = "\n", ostream &out = cout){
        for(auto item: container) out << item << separator;
        out << finish;
    }
 
template <class T>
    void remove_dup(vector<T> &a){
        sort(ALL(a));
        a.resize(unique(ALL(a)) - a.begin());
    }

int valid(int n, int a[]){
    vector<int> b(n);
    for(int i = 0; i<n; ++i) b[i] = a[i];
    remove_dup(b); 
    if (b.size() < n) return 0;

    int idx = -1;
    for(int i= 0; i<n; ++i) if (a[i] <= n){
        idx = (i - a[i] + n + 1) % n;
        break;
    }
    if (idx == -1) return 1;

    for(int i = 0; i<n; ++i){
        int j = (idx + i) % n;
        if (a[j] != i + 1 && a[j] <= n) return 0;
    }
    return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[]){

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

}


// int main(void){
//     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


//     return 0;
// }

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:52:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   52 |     if (b.size() < n) return 0;
      |         ~~~~~~~~~^~~
gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:69:1: warning: no return statement in function returning non-void [-Wreturn-type]
   69 | }
      | ^
gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:72:1: warning: no return statement in function returning non-void [-Wreturn-type]
   72 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 6 ms 860 KB Output is correct
7 Correct 12 ms 1628 KB Output is correct
8 Correct 9 ms 1368 KB Output is correct
9 Correct 3 ms 600 KB Output is correct
10 Correct 12 ms 1372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 6 ms 860 KB Output is correct
7 Correct 11 ms 1624 KB Output is correct
8 Correct 8 ms 1620 KB Output is correct
9 Correct 3 ms 604 KB Output is correct
10 Correct 12 ms 1372 KB Output is correct
11 Correct 1 ms 352 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 5 ms 860 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 12 ms 1592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 352 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 444 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -