답안 #677597

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
677597 2023-01-03T21:53:36 Z Mariabf Baloni (COCI15_baloni) C++17
100 / 100
501 ms 324 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int>nums;
    for(int i=0; i<n; i++){
        int x;
        cin>>x;
        bool found=false;
        for(int j=0; j<nums.size(); j++){
            if(nums[j]==x+1){
                nums[j]--;
                found=true;
                break;
            }
        }if(not found){
            nums.push_back(x);
        }
    }cout<<nums.size();
}

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |         for(int j=0; j<nums.size(); j++){
      |                      ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 329 ms 292 KB Output is correct
6 Correct 501 ms 320 KB Output is correct
7 Correct 411 ms 324 KB Output is correct
8 Correct 395 ms 212 KB Output is correct
9 Correct 362 ms 292 KB Output is correct
10 Correct 478 ms 308 KB Output is correct