Submission #1241132

#TimeUsernameProblemLanguageResultExecution timeMemory
1241132santi3223코끼리 (Dancing Elephants) (IOI11_elephants)C++20
26 / 100
9094 ms2136 KiB
#include <bits/stdc++.h> #include "elephants.h" using namespace std; #define ll long long #define vl vector<ll> #define all(aaa) aaa.begin(), aaa.end() #define ff(aa, bb, cc) for(ll aa = bb; aa < cc; aa++) #define vb vector<bool> #define ed "\n" #define pb push_back #define pll pair<ll, ll> #define fi first #define se second /* #define MAX_N 1000000 #define MAX_M 1000000 */ ll n, l; vl arr, sorted; void init(int N, int L, int X[]){ n = N; l = L; ff(i, 0, n){ arr.pb(X[i]); } sorted = arr; sort(all(sorted)); } int update(int id, int y){ //ll pos = lower_bound(all(sorted), arr[id]) - sorted.begin(); ll ref = arr[id]; ff(i, 0, n){ if(sorted[i] == ref){ sorted.erase(sorted.begin()+i); break; } } sorted.pb(y); for(ll i = n-2; i >= 0; i--){ if(sorted[i] > sorted[i+1]){ swap(sorted[i], sorted[i+1]); } else{ break; } } arr[id] = y; ll st = sorted[0]; ll c = 1; ff(i, 1, n){ if(st+l < sorted[i]){ c++; st = sorted[i]; } } /*ff(i, 0, n){ cout << sorted[i] << " "; } cout << ed;*/ return c; } /* static int N,L,M; static int X[MAX_N]; static int ii[MAX_M]; static int yy[MAX_M]; static int sol[MAX_M]; void read_input() { int i; cin >> N >> L >> M; for(i=0; i<N; i++) cin >> X[i]; for(i=0; i<M; i++) cin >> ii[i] >> yy[i] >> sol[i]; } int main() { int i, ans; read_input(); init(N,L,X); for(i=0; i<M; i++) { ans = update(ii[i],yy[i]); if(ans==sol[i])continue; printf("Incorrect. In %d-th move, answered %d (%d expected).\n", i+1, ans, sol[i]); return 0; } printf("Correct.\n"); return 0; } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...