답안 #292358

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
292358 2020-09-06T21:33:08 Z MilosMilutinovic Baloni (COCI15_baloni) C++14
0 / 100
233 ms 7548 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    scanf("%i",&n);
    int a[n];
    for(int i=0;i<n;i++)scanf("%i",&a[i]);
    int ans=0;
    map<int,int> mp;
    for(int i=0;i<n;i++){
        if(!mp[a[i]+1])ans++;
        mp[a[i]]=1;
    }
    printf("%i",ans);
    return 0;
}

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    5 |     scanf("%i",&n);
      |     ~~~~~^~~~~~~~~
baloni.cpp:7:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     for(int i=0;i<n;i++)scanf("%i",&a[i]);
      |                         ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Incorrect 2 ms 384 KB Output isn't correct
5 Incorrect 233 ms 7196 KB Output isn't correct
6 Incorrect 226 ms 7548 KB Output isn't correct
7 Incorrect 181 ms 6136 KB Output isn't correct
8 Incorrect 174 ms 6136 KB Output isn't correct
9 Incorrect 202 ms 6648 KB Output isn't correct
10 Incorrect 199 ms 6648 KB Output isn't correct