Submission #784090

#TimeUsernameProblemLanguageResultExecution timeMemory
784090rainboyLightning Rod (NOI18_lightningrod)C11
100 / 100
1786 ms225936 KiB
#include <stdio.h> #define N 10000000 int main() { static int qu[N], ll[N], rr[N]; int n, cnt, i, x, y; scanf("%d", &n); cnt = 0; for (i = 0; i < n; i++) { scanf("%d%d", &x, &y); ll[i] = x - y, rr[i] = x + y; if (cnt == 0 || rr[qu[cnt - 1]] < rr[i]) { while (cnt && ll[qu[cnt - 1]] >= ll[i]) cnt--; qu[cnt++] = i; } } printf("%d\n", cnt); return 0; }

Compilation message (stderr)

lightningrod.c: In function 'main':
lightningrod.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
lightningrod.c:12:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%d%d", &x, &y);
      |   ^~~~~~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...