답안 #966117

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
966117 2024-04-19T11:59:42 Z blackslex Alternating Heights (CCO22_day1problem1) C++17
4 / 25
350 ms 49112 KB
#include<bits/stdc++.h>

using namespace std;

int n, k, q, x, y;

int main() {
    scanf("%d %d %d", &n, &k, &q);
    vector<int> a(n + 5);
    vector<vector<int>> dp(n + 5, vector<int>(n + 5));
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++) {
        vector<vector<int>> cnt(2, vector<int>(k + 5));
        bool ck = 0;
        for (int j = i; j <= n; j++) {
            if (cnt[!(j & 1)][a[j]]) ck = 1;
            cnt[j & 1][a[j]]++;
            dp[i][j] = ck;
        }
    }
    while (q--) scanf("%d %d", &x, &y), printf("%s\n", dp[x][y] ? "NO" : "YES");
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d %d %d", &n, &k, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:11:39: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
      |                                  ~~~~~^~~~~~~~~~~~~
Main.cpp:21:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     while (q--) scanf("%d %d", &x, &y), printf("%s\n", dp[x][y] ? "NO" : "YES");
      |                 ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 294 ms 48212 KB Output is correct
2 Correct 306 ms 48084 KB Output is correct
3 Correct 292 ms 47924 KB Output is correct
4 Correct 166 ms 7248 KB Output is correct
5 Correct 181 ms 9556 KB Output is correct
6 Correct 292 ms 47956 KB Output is correct
7 Correct 283 ms 47836 KB Output is correct
8 Correct 275 ms 48208 KB Output is correct
9 Correct 286 ms 48224 KB Output is correct
10 Correct 350 ms 48468 KB Output is correct
11 Correct 294 ms 49112 KB Output is correct
12 Correct 246 ms 48468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 191 ms 12060 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 294 ms 48212 KB Output is correct
2 Correct 306 ms 48084 KB Output is correct
3 Correct 292 ms 47924 KB Output is correct
4 Correct 166 ms 7248 KB Output is correct
5 Correct 181 ms 9556 KB Output is correct
6 Correct 292 ms 47956 KB Output is correct
7 Correct 283 ms 47836 KB Output is correct
8 Correct 275 ms 48208 KB Output is correct
9 Correct 286 ms 48224 KB Output is correct
10 Correct 350 ms 48468 KB Output is correct
11 Correct 294 ms 49112 KB Output is correct
12 Correct 246 ms 48468 KB Output is correct
13 Incorrect 191 ms 12060 KB Output isn't correct
14 Halted 0 ms 0 KB -