답안 #349599

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
349599 2021-01-18T00:20:56 Z Elephant52 전선 연결 (IOI17_wiring) C++11
0 / 100
1 ms 384 KB
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vpi;

#define INF 1000000000
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)

int64_t min_total_length(vi r, vi b) {
    int N = r.size(), M = b.size();
    
    int64_t res = 0;
    
    for (int cur_height : r) {
        int64_t score = 0;
        auto it = lower_bound(b.begin(), b.end(), cur_height);
        
        if (it != b.end())
            score = max(score, (int64_t)*it);
        
        if (it != b.begin())
            --it;
        
        score = max(score, (int64_t)*it);
        
        res += score;
    }
    
    return res;
}

Compilation message

wiring.cpp: In function 'int64_t min_total_length(vi, vi)':
wiring.cpp:18:9: warning: unused variable 'N' [-Wunused-variable]
   18 |     int N = r.size(), M = b.size();
      |         ^
wiring.cpp:18:23: warning: unused variable 'M' [-Wunused-variable]
   18 |     int N = r.size(), M = b.size();
      |                       ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB 3rd lines differ - on the 1st token, expected: '25859', found: '28770'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB 3rd lines differ - on the 1st token, expected: '904', found: '1120'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB 3rd lines differ - on the 1st token, expected: '316', found: '312'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 376 KB 3rd lines differ - on the 1st token, expected: '27', found: '122'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB 3rd lines differ - on the 1st token, expected: '25859', found: '28770'
2 Halted 0 ms 0 KB -