답안 #469649

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
469649 2021-09-01T14:26:42 Z Itamar Exam (eJOI20_exam) C++14
27 / 100
13 ms 448 KB
#include <vector>
#include <algorithm>
using namespace std;
#include <iostream>

vector<int> pre;
int n;
/*int lower_bo(int l, int r, int val) {
    int mid = (l + r) / 2;
    if (pre[mid] < val && (mid == n || pre[mid+1] >= val) ) {
        return mid+1;
    }
    if (pre[mid] < val) {
        return lower_bo(mid + 1, r, val);
    }
    if (pre[mid] > val) {
        return lower_bo(l, mid - 1, val);
    }
}*/
int main()
{
    int n;
    cin >> n;
    vector<int> r;
    vector<int> m;

    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        m.push_back(x);
    }
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        for (int j = i; j < n; j++) {

            if (x == m[j]) {
                r.push_back(x);
                break;
            }
        }
    }
    int siz = r.size();
    vector<int>max(siz, -1);
    int mini = 0;
    for (int i = 0; i < siz; i++) {
        
        for (int j = 0; j < siz; j++) {

            if (max[j] <= r[i] && max[j] != -1) {
                if (max[j + 1] > r[i] || max[j + 1] == -1) {
                    max[j + 1] = r[i];
                    break;
                }
                
            }
        }
        if (max[0] > r[i] || max[0] == -1) {
            max[0] = r[i];
        }

        
    }
    int maxi = 0;
    for (int i = siz-1; i >= 0; i--) {
        if (max[i] != -1) {
            cout << i+1;
            break;
        }
    }
}

Compilation message

exam.cpp: In function 'int main()':
exam.cpp:45:9: warning: unused variable 'mini' [-Wunused-variable]
   45 |     int mini = 0;
      |         ^~~~
exam.cpp:64:9: warning: unused variable 'maxi' [-Wunused-variable]
   64 |     int maxi = 0;
      |         ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 10 ms 392 KB Output is correct
5 Correct 8 ms 396 KB Output is correct
6 Correct 10 ms 448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 3 ms 332 KB Output is correct
10 Correct 10 ms 392 KB Output is correct
11 Correct 8 ms 396 KB Output is correct
12 Correct 10 ms 448 KB Output is correct
13 Incorrect 1 ms 204 KB Output isn't correct
14 Halted 0 ms 0 KB -