답안 #292359

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
292359 2020-09-06T21:35:12 Z MilosMilutinovic Baloni (COCI15_baloni) C++14
100 / 100
303 ms 4088 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++;
        else mp[a[i]+1]--;
        mp[a[i]]++;
    }
    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 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 301 ms 3704 KB Output is correct
6 Correct 303 ms 4088 KB Output is correct
7 Correct 241 ms 3448 KB Output is correct
8 Correct 229 ms 3324 KB Output is correct
9 Correct 267 ms 3452 KB Output is correct
10 Correct 267 ms 3704 KB Output is correct