답안 #23479

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
23479 2017-05-10T02:36:09 Z TAMREF 이상한 수열 (OJUZ10_bizarre) C++11
24 / 100
19 ms 11392 KB
#include <bits/stdc++.h>
using namespace std;
int S[200000], A[2000005], cnt[200000];
const int bias=1000000;
int main(){
    int N,M; scanf("%d",&N);
    for(int i=1;i<=N;i++){
        scanf("%d",&S[i]);
        cnt[i]=cnt[i-1]+(A[S[i]+bias]++?0:1);
    } scanf("%d",&M);
    if(M<=N) return !printf("%d\n",cnt[M]);
    cnt[N+1]=cnt[N];
    for(int i=N+2;i<=M;i++)
        cnt[i]=cnt[i-1]+(A[cnt[i-1]+bias]++?0:1);
    return !printf("%d\n",cnt[M]);
}

Compilation message

bizarre.cpp: In function 'int main()':
bizarre.cpp:6:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int N,M; scanf("%d",&N);
                            ^
bizarre.cpp:8:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&S[i]);
                          ^
bizarre.cpp:10:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     } scanf("%d",&M);
                     ^
# 결과 실행 시간 메모리 Grader output
1 Halted 0 ms 0 KB -
2 Incorrect 0 ms 11392 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 11392 KB Output is correct
2 Correct 0 ms 11392 KB Output is correct
3 Correct 0 ms 11392 KB Output is correct
4 Correct 0 ms 11392 KB Output is correct
5 Correct 0 ms 11392 KB Output is correct
6 Correct 0 ms 11392 KB Output is correct
7 Correct 0 ms 11392 KB Output is correct
8 Correct 0 ms 11392 KB Output is correct
9 Correct 0 ms 11392 KB Output is correct
10 Correct 0 ms 11392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 11392 KB Output isn't correct
2 Correct 6 ms 11392 KB Output is correct
3 Correct 3 ms 11392 KB Output is correct
4 Correct 0 ms 11392 KB Output is correct
5 Halted 0 ms 0 KB -
6 Correct 3 ms 11392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 19 ms 11392 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -