Submission #813493

#TimeUsernameProblemLanguageResultExecution timeMemory
813493EntityPlanttExam (eJOI20_exam)C++14
0 / 100
2 ms468 KiB
#include <iostream> using namespace std; int n, a[10000], b[10000], i, j, v, r; bool bo; int main() { scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", a + i); scanf("%d", b); v = *b; for (i = 1; i < n; i++) { scanf("%d", b + i); if (v != b[i]) v = 0; } if (v) { for (i = 0, j = -1; i < n; i++) { if (a[i] > v) { if (bo) r += i - j - 1; bo = false; j = i; } else if (a[i] == v) bo = true; } if (bo) r += n - j - 1; printf("%d", r); return 0; } if (n > 5000) { // Segment tree return 0; } // DP return 0; }

Compilation message (stderr)

exam.cpp: In function 'int main()':
exam.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
exam.cpp:7:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     for (i = 0; i < n; i++) scanf("%d", a + i);
      |                             ~~~~~^~~~~~~~~~~~~
exam.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d", b); v = *b;
      |     ~~~~~^~~~~~~~~
exam.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%d", b + i);
      |         ~~~~~^~~~~~~~~~~~~
#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...