답안 #831847

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
831847 2023-08-20T16:02:17 Z QwertyPi Measures (CEOI22_measures) C++14
10 / 100
1500 ms 5524 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int MAXN = 2e5 + 11;

int n, m, d;

int solve(vector<int>& a){
    vector<int> x;
    for(int i = 0; i < a.size(); i++){
        x.push_back(a[i] - i * d);
    }
    int mx = 0;
    for(int i = 0; i < x.size(); i++){
        for(int j = i; j < x.size(); j++){
            mx = max(mx, x[i] - x[j]);
        }
    }
    return mx;
}

int32_t main(){
    cin >> n >> m >> d;
    vector<int> a; for(int i = 0; i < n; i++) { int v; cin >> v; a.push_back(v); }
    for(int i = 0; i < m; i++){
        int v; cin >> v; a.push_back(v);
        sort(a.begin(), a.end());
        int ans = solve(a);
        cout << ans / 2 << (ans % 2 ? ".5" : "") << ' ';
    }
    cout << endl;
}

Compilation message

Main.cpp: In function 'long long int solve(std::vector<long long int>&)':
Main.cpp:11:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(int i = 0; i < a.size(); i++){
      |                    ~~^~~~~~~~~~
Main.cpp:15:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i = 0; i < x.size(); i++){
      |                    ~~^~~~~~~~~~
Main.cpp:16:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for(int j = i; j < x.size(); j++){
      |                        ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 340 KB Output is correct
2 Correct 21 ms 316 KB Output is correct
3 Correct 20 ms 340 KB Output is correct
4 Correct 21 ms 340 KB Output is correct
5 Correct 21 ms 340 KB Output is correct
6 Correct 21 ms 312 KB Output is correct
7 Correct 22 ms 308 KB Output is correct
8 Correct 21 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 340 KB Output is correct
2 Correct 21 ms 316 KB Output is correct
3 Correct 20 ms 340 KB Output is correct
4 Correct 21 ms 340 KB Output is correct
5 Correct 21 ms 340 KB Output is correct
6 Correct 21 ms 312 KB Output is correct
7 Correct 22 ms 308 KB Output is correct
8 Correct 21 ms 340 KB Output is correct
9 Execution timed out 1559 ms 5524 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1562 ms 400 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1562 ms 400 KB Time limit exceeded
2 Halted 0 ms 0 KB -