답안 #593291

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
593291 2022-07-10T19:23:29 Z LucaGreg Simple game (IZhO17_game) C++14
0 / 100
5 ms 8020 KB
#include <bits/stdc++.h>

using namespace std;

long long int sp[1000010];
int h[1000010];

int main()
{
    int n, m; scanf("%d %d", &n, &m);
    scanf("%d", &h[0]);
    for(int i=1;i<n;i++){
        scanf("%d", &h[i]);
        sp[min(h[i-1], h[i])] += 1;
        sp[max(h[i-1], h[i])+1] -= 1;
    }
    for(int i=1;i<1000010;i++){
        sp[i] += sp[i-1];
    }
    for(int i=0;i<m;i++){
        int t; scanf("%d", &t);
        if(t==2){
            int hq; scanf("%d", &hq);
            printf("%lld\n", sp[hq]);
        }else{
            int pos, val; scanf("%d %d", &pos, &val);
        }
    }
    
    
    return 0;
}

Compilation message

game.cpp: In function 'int main()':
game.cpp:11:20: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     int n, m; scanf("%d %d", &n, &m);
      |               ~~~~~^~~~~~~~~~~~~~~~~
game.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d", &h[0]);
      |     ~~~~~^~~~~~~~~~~~~
game.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%d", &h[i]);
      |         ~~~~~^~~~~~~~~~~~~
game.cpp:22:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         int t; scanf("%d", &t);
      |                ~~~~~^~~~~~~~~~
game.cpp:24:26: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |             int hq; scanf("%d", &hq);
      |                     ~~~~~^~~~~~~~~~~
game.cpp:27:32: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |             int pos, val; scanf("%d %d", &pos, &val);
      |                           ~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 8020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 8020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 8020 KB Output isn't correct
2 Halted 0 ms 0 KB -