Submission #966117

#TimeUsernameProblemLanguageResultExecution timeMemory
966117blackslexAlternating Heights (CCO22_day1problem1)C++17
4 / 25
350 ms49112 KiB
#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 (stderr)

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");
      |                 ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...