답안 #333556

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
333556 2020-12-07T04:23:38 Z juggernaut Money (IZhO17_money) C++14
0 / 100
1 ms 384 KB
#include<bits/stdc++.h>
using namespace std;
int n,a[1000005],pos,ans,mx;
set<int>st;
int main(){
    st.insert(2e9);
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    while(pos<n){
        ans++;
        mx=*st.upper_bound(a[pos]);
        st.insert(a[pos]);
        while(pos+1<n&&a[pos]<a[pos+1]&&a[pos+1]<=mx)pos++,st.insert(a[pos]);
        //cout<<pos<<" ";
        pos++;
    }
    printf("%d",ans);
}

Compilation message

money.cpp: In function 'int main()':
money.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
money.cpp:8:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |     for(int i=0;i<n;i++)scanf("%d",&a[i]);
      |                         ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 376 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 376 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 376 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 376 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -