Submission #829487

#TimeUsernameProblemLanguageResultExecution timeMemory
829487rainboyCurtains (NOI23_curtains)C11
24 / 100
176 ms18288 KiB
#include <stdio.h> #define N 2000 #define M 500000 int main() { static char has[N][N], can[N][N]; static int ll[N], qu[N]; int n, m, q, cnt, l, r; scanf("%d%d%d", &n, &m, &q); while (m--) { scanf("%d%d", &l, &r), l--, r--; has[l][r] = 1; } for (r = 0; r < n; r++) ll[r] = r + 1; for (l = n - 1; l >= 0; l--) { for (r = l; r < n; r++) if (has[l][r]) ll[r] = l; cnt = 0; for (r = l; r < n; r++) { qu[cnt++] = r; while (cnt && qu[cnt - 1] >= ll[r]) cnt--; can[l][r] = cnt == 0; } } while (q--) { scanf("%d%d", &l, &r), l--, r--; printf(can[l][r] ? "YES\n" : "NO\n"); } return 0; }

Compilation message (stderr)

curtains.c: In function 'main':
curtains.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d%d%d", &n, &m, &q);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
curtains.c:13:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d%d", &l, &r), l--, r--;
      |   ^~~~~~~~~~~~~~~~~~~~~
curtains.c:31:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |   scanf("%d%d", &l, &r), l--, r--;
      |   ^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...