답안 #813493

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
813493 2023-08-07T18:53:20 Z EntityPlantt Exam (eJOI20_exam) C++14
0 / 100
2 ms 468 KB
#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

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);
      |         ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 2 ms 468 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -