답안 #969454

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
969454 2024-04-25T07:42:57 Z efedmrlr Measures (CEOI22_measures) C++17
10 / 100
1500 ms 5468 KB
#include <bits/stdc++.h>

#define int long long int
#define ld long double
#define pb push_back
#define MP make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.begin(), x.end()
#define REP(i, n) for(int i = 0; (i) < (n); (i)++)

using namespace std;

void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const int N = 2e5 + 5;
const int INF = 1e17;


int D;

void solve() {
    int n, m;
    cin >> n >> m >> D;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    for(int z = 0; z < m; z++) {
        int b;
        cin >> b;
        a.pb(b);
        sort(all(a));
        int v = 0;
        for(int i = 0; i < a.size(); i++) {
            for(int j = i + 1; j < a.size(); j++) {
                v = max(v, (a[i] - i * D) - (a[j] - j * D));
            }
        }
        if(v & 1) {
            cout << v / 2 << ".5 ";
        }
        else {
            cout << v / 2 << " ";
        }
    }
    cout << "\n";
}

signed main() {
    fastio();
    solve();
}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:35: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]
   35 |         for(int i = 0; i < a.size(); i++) {
      |                        ~~^~~~~~~~~~
Main.cpp:36:34: 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]
   36 |             for(int j = i + 1; j < a.size(); j++) {
      |                                ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 348 KB Output is correct
2 Correct 19 ms 504 KB Output is correct
3 Correct 19 ms 348 KB Output is correct
4 Correct 20 ms 344 KB Output is correct
5 Correct 19 ms 348 KB Output is correct
6 Correct 20 ms 508 KB Output is correct
7 Correct 20 ms 348 KB Output is correct
8 Correct 19 ms 508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 348 KB Output is correct
2 Correct 19 ms 504 KB Output is correct
3 Correct 19 ms 348 KB Output is correct
4 Correct 20 ms 344 KB Output is correct
5 Correct 19 ms 348 KB Output is correct
6 Correct 20 ms 508 KB Output is correct
7 Correct 20 ms 348 KB Output is correct
8 Correct 19 ms 508 KB Output is correct
9 Execution timed out 1529 ms 5468 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1566 ms 596 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1566 ms 596 KB Time limit exceeded
2 Halted 0 ms 0 KB -