Submission #745673

# Submission time Handle Problem Language Result Execution time Memory
745673 2023-05-21T00:10:55 Z 반딧불(#9962) Alternating Heights (CCO22_day1problem1) C++17
4 / 25
261 ms 13624 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, k, q;
int arr[3002];
int sum[3002];

int main(){
    scanf("%d %d %d", &n, &k, &q);
    for(int i=1; i<=n; i++){
        scanf("%d", &arr[i]);
        sum[i] = (arr[i-1] != arr[i]);
        sum[i] += sum[i-1];
    }
    for(int i=1; i<=q; i++){
        int l, r;
        scanf("%d %d", &l, &r);
        if(sum[r] - sum[l] == (r - l)) printf("YES\n");
        else printf("NO\n");
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d %d %d", &n, &k, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%d", &arr[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
Main.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%d %d", &l, &r);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 199 ms 12560 KB Output is correct
2 Correct 210 ms 12584 KB Output is correct
3 Correct 201 ms 12684 KB Output is correct
4 Correct 186 ms 7176 KB Output is correct
5 Correct 185 ms 9188 KB Output is correct
6 Correct 230 ms 12664 KB Output is correct
7 Correct 205 ms 12564 KB Output is correct
8 Correct 221 ms 12608 KB Output is correct
9 Correct 202 ms 12732 KB Output is correct
10 Correct 223 ms 13064 KB Output is correct
11 Correct 197 ms 13624 KB Output is correct
12 Correct 199 ms 12972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 261 ms 11236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 199 ms 12560 KB Output is correct
2 Correct 210 ms 12584 KB Output is correct
3 Correct 201 ms 12684 KB Output is correct
4 Correct 186 ms 7176 KB Output is correct
5 Correct 185 ms 9188 KB Output is correct
6 Correct 230 ms 12664 KB Output is correct
7 Correct 205 ms 12564 KB Output is correct
8 Correct 221 ms 12608 KB Output is correct
9 Correct 202 ms 12732 KB Output is correct
10 Correct 223 ms 13064 KB Output is correct
11 Correct 197 ms 13624 KB Output is correct
12 Correct 199 ms 12972 KB Output is correct
13 Incorrect 261 ms 11236 KB Output isn't correct
14 Halted 0 ms 0 KB -