Submission #963649

# Submission time Handle Problem Language Result Execution time Memory
963649 2024-04-15T12:21:58 Z Amr Dancing Elephants (IOI11_elephants) C++17
26 / 100
12 ms 8792 KB
#include "elephants.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define sz size()
const int N = 102;
ll n , l;
ll a[N];
ll b[N];
void init(int N, int L, int X[])
{
    n = N;
    l = L;
    for(int i = 0; i < n; i++) a[i] = X[i],b[i] = X[i];
    sort(a,a+n);
}

int update(int i, int y)
{
    ll x = b[i],in = 0;
    b[i] = y;
    for(int i = 0; i < n; i++)
    {
        if(a[i]==x) {in = i; break;}
    }
    a[in] = y;
    for(int i = in+1; i < n; i++)
        if(a[i-1]>a[i]) swap(a[i-1],a[i]);
    for(int i = in-1; i >= 0; i--)
        if(a[i+1]<a[i]) swap(a[i+1],a[i]);
        //for(int i  = 0; i < n; i++) cout << a[i] << " "; cout << endl;
    ll cnt = 1, dis = 0;
    for(int i = 1; i < n; i++)
    {
        //cout << v[i] << " ";
        if(dis+a[i]-a[i-1]>l)
        {
            cnt++;
            dis = 0;
        }
        else dis+=a[i]-a[i-1];
    }
  return cnt;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6488 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6488 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6488 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Incorrect 12 ms 8792 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6488 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Incorrect 12 ms 8792 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6488 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Incorrect 12 ms 8792 KB Output isn't correct
8 Halted 0 ms 0 KB -