답안 #667650

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
667650 2022-12-01T20:53:19 Z Hacv16 Table Tennis (info1cup20_tabletennis) C++17
20 / 100
3000 ms 5252 KB
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const int MAX = 2e6 + 50;
const int INF = 0x3f3f3f3f;

ll n, k, ans;
vector<ll> v;

bool check(int j){
    vector<ll> aux;

    for(int i = 0; i < v.size(); i++){
        if(i >= j && i <= j + k - 1) continue;
        aux.push_back(v[i]);
    }

    ll sum = aux[0] + aux[aux.size() - 1];

    for(int l = 1, r = aux.size() - 2; l < r; l++, r--)
        if(aux[l] + aux[r] != sum) return false;

    return true;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> k;

    for(int i = 0; i < n + k; i++){
        ll x; cin >> x;
        v.push_back(x);
    }

    for(int i = 0; i <= v.size() - k + 1; i++)
        if(check(i)){ ans = i; break;}

    for(int i = 0; i < v.size(); i++){
        if(i >= ans && i <= ans + k - 1) continue;
        cout << v[i] << ' ';
    }

    cout << '\n';

    return 0;
}

Compilation message

tabletennis.cpp: In function 'bool check(int)':
tabletennis.cpp:14:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int i = 0; i < v.size(); i++){
      |                    ~~^~~~~~~~~~
tabletennis.cpp: In function 'int main()':
tabletennis.cpp:38:22: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
   38 |     for(int i = 0; i <= v.size() - k + 1; i++)
      |                    ~~^~~~~~~~~~~~~~~~~~~
tabletennis.cpp:41:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for(int i = 0; i < v.size(); i++){
      |                    ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 13 ms 364 KB Output is correct
3 Correct 11 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1166 ms 1024 KB Output is correct
2 Correct 26 ms 4496 KB Output is correct
3 Execution timed out 3040 ms 5252 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3092 ms 5088 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output does not have symmetry property
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 8 ms 360 KB Output does not have symmetry property
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 3066 ms 5196 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 3080 ms 5084 KB Time limit exceeded
3 Halted 0 ms 0 KB -