Submission #1240945

#TimeUsernameProblemLanguageResultExecution timeMemory
1240945santi3223Dancing Elephants (IOI11_elephants)C++20
26 / 100
9094 ms1980 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; void init(int N, int L, int X[]){ n = N; l = L; ff(i, 0, n){ arr.pb(X[i]); } } int update(int pos, int y){ arr[pos] = y; vl cur = arr; sort(all(cur)); ll st = cur[0]; ll c = 1; ff(i, 1, n){ if(st+l < cur[i]){ c++; st = cur[i]; } } /*ff(i, 0, n){ cout << cur[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...