Submission #120000

# Submission time Handle Problem Language Result Execution time Memory
120000 2019-06-22T23:14:45 Z Osama_Alkhodairy Dancing Elephants (IOI11_elephants) C++17
26 / 100
9000 ms 1788 KB
#include <bits/stdc++.h>
#include "elephants.h"
//~ #include "grader.cpp"
using namespace std;

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

int n, l;
vector <pair <int, int> > a;

void init(int N, int L, int X[]){
    n = N;
    l = L;
    for(int i = 0 ; i < n ; i++){
        a.push_back(make_pair(X[i], i));
    }
}
int update(int i, int y){
    for(int j = 0 ; j < n ; j++){
        if(a[j].second == i){
            a.erase(a.begin() + j);
            break;
        }
    }
    for(int j = 0 ; j < n ; j++){
        if(j == n - 1 || a[j].first > y){
            a.insert(a.begin() + j, make_pair(y, i));
            break;
        }
    }
    int cur = a[0].first;
    int ans = 1;
    for(auto &i : a){
        if(cur + l < i.first){
            cur = i.first;
            ans++;
        }
    }
    return ans;
}

Compilation message

elephants.cpp:7:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization ("O3")
 
elephants.cpp:8:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization ("unroll-loops")
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2707 ms 1280 KB Output is correct
8 Correct 3917 ms 1408 KB Output is correct
9 Correct 4937 ms 1780 KB Output is correct
10 Correct 5682 ms 1788 KB Output is correct
11 Correct 5340 ms 1788 KB Output is correct
12 Execution timed out 9028 ms 1780 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2707 ms 1280 KB Output is correct
8 Correct 3917 ms 1408 KB Output is correct
9 Correct 4937 ms 1780 KB Output is correct
10 Correct 5682 ms 1788 KB Output is correct
11 Correct 5340 ms 1788 KB Output is correct
12 Execution timed out 9028 ms 1780 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2707 ms 1280 KB Output is correct
8 Correct 3917 ms 1408 KB Output is correct
9 Correct 4937 ms 1780 KB Output is correct
10 Correct 5682 ms 1788 KB Output is correct
11 Correct 5340 ms 1788 KB Output is correct
12 Execution timed out 9028 ms 1780 KB Time limit exceeded
13 Halted 0 ms 0 KB -