답안 #786274

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
786274 2023-07-18T06:04:13 Z AbdelmagedNour 코끼리 (Dancing Elephants) (IOI11_elephants) C++17
50 / 100
9000 ms 2260 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
//#include "grader.cpp"
using namespace std;
const int MAXN=50000;
int arr[MAXN+2],pos[MAXN];
int n,len;
void init(int N, int L, int X[]){
    n=N;len=L;
	arr[N+1]=2e9;arr[0]=-2e9;
    for(int i=0;i<N;i++)arr[i+1]=pos[i]=X[i];
}
int update(int idx, int y){
    int j=0;
    while(arr[j]!=pos[idx])j++;
    arr[j]=pos[idx]=y;
    while(arr[j]<arr[j-1])swap(arr[j],arr[j-1]),j--;
    while(arr[j]>arr[j+1])swap(arr[j],arr[j+1]),j++;
    int res=1,lst=arr[1];
    for(register int i=1;i<=n;i++){
        if(arr[i]-lst>len)res++,lst=arr[i];
    }
    return res;
}

Compilation message

elephants.cpp: In function 'int update(int, int)':
elephants.cpp:20:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |     for(register int i=1;i<=n;i++){
      |                      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 578 ms 1688 KB Output is correct
8 Correct 805 ms 1744 KB Output is correct
9 Correct 1567 ms 2120 KB Output is correct
10 Correct 2734 ms 2124 KB Output is correct
11 Correct 2744 ms 2128 KB Output is correct
12 Correct 5825 ms 2124 KB Output is correct
13 Correct 2983 ms 2124 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 578 ms 1688 KB Output is correct
8 Correct 805 ms 1744 KB Output is correct
9 Correct 1567 ms 2120 KB Output is correct
10 Correct 2734 ms 2124 KB Output is correct
11 Correct 2744 ms 2128 KB Output is correct
12 Correct 5825 ms 2124 KB Output is correct
13 Correct 2983 ms 2124 KB Output is correct
14 Correct 1109 ms 1996 KB Output is correct
15 Correct 1571 ms 2052 KB Output is correct
16 Execution timed out 9042 ms 2260 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 578 ms 1688 KB Output is correct
8 Correct 805 ms 1744 KB Output is correct
9 Correct 1567 ms 2120 KB Output is correct
10 Correct 2734 ms 2124 KB Output is correct
11 Correct 2744 ms 2128 KB Output is correct
12 Correct 5825 ms 2124 KB Output is correct
13 Correct 2983 ms 2124 KB Output is correct
14 Correct 1109 ms 1996 KB Output is correct
15 Correct 1571 ms 2052 KB Output is correct
16 Execution timed out 9042 ms 2260 KB Time limit exceeded
17 Halted 0 ms 0 KB -