Submission #1064587

# Submission time Handle Problem Language Result Execution time Memory
1064587 2024-08-18T15:02:34 Z sunboi Gondola (IOI14_gondola) C++14
55 / 100
26 ms 5416 KB
#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;
 
 
 
int valid(int n, int inputSeq[]){
    vector<int> a;
    int mn = 1e6;
    set<int> val;
    for (int i = 0; i < n; i++){
        mn = min(mn, inputSeq[i]);
        val.insert(inputSeq[i]);
    }
    for (int i = 0; i < n; i++){
        if (inputSeq[i] == mn) a.push_back(mn);
        else if (!a.empty()){
            a.push_back(inputSeq[i]);
        }
        
    }
    
    for (int i = 0; i < n; i++){
        if (inputSeq[i] == mn) break;
        a.push_back(inputSeq[i]);
    }
    
    
    int cnt = a[0];
    int f = 1;
    for (int i = 0; i < n; i++){
        if (cnt == a[i] || a[i] >= n + 1) {
            cnt++;
            continue;
        }
        
        f = 0;
    }
    if ((int)(val.size()) != n) f = 0;
    return f;
}
 
 
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
    vector<int> a;
    int mn = 1e6;
    for (int i = 0; i < n; i++){
        mn = min(mn, gondolaSeq[i]);
    }
    for (int i = 0; i < n; i++){
        if (gondolaSeq[i] == mn) a.push_back(mn);
        else if (!a.empty()){
            a.push_back(gondolaSeq[i]);
        }
        
    }
    
    for (int i = 0; i < n; i++){
        if (gondolaSeq[i] == mn) break;
        a.push_back(gondolaSeq[i]);
    }
    
    
    int cnt = a[0];
    if (a[0] >= n + 1) cnt = 1;
    
    set<pair<int, int>> repla;
    
    for (int i = 0; i < n; i++){
        if (cnt == n + 1) cnt = 1;
        
        if (cnt == a[i]) {
            cnt++;
            continue;
        }else{
            repla.insert({a[i], cnt});
            cnt++;
        }
    }
    
    int l = 0;
    int cur = n + 1;
    for (auto x : repla){
        //cout << x.first << ' ' << x.second << endl;
        replacementSeq[l] = x.second;
        l++;
        while(cur < x.first){
            replacementSeq[l] = cur;
            l++;
            cur++;
        }
        cur++;
    }
    return l;
}


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



# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 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 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 8 ms 2652 KB Output is correct
7 Correct 20 ms 4440 KB Output is correct
8 Correct 13 ms 4568 KB Output is correct
9 Correct 5 ms 1628 KB Output is correct
10 Correct 18 ms 5220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 0 ms 348 KB Output is correct
6 Correct 7 ms 2652 KB Output is correct
7 Correct 19 ms 4316 KB Output is correct
8 Correct 14 ms 4564 KB Output is correct
9 Correct 5 ms 1732 KB Output is correct
10 Correct 19 ms 5280 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 10 ms 2528 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 26 ms 5416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 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 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# 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 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 7 ms 1860 KB Output is correct
12 Correct 7 ms 1748 KB Output is correct
13 Correct 14 ms 2916 KB Output is correct
14 Correct 6 ms 1752 KB Output is correct
15 Correct 15 ms 3096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -