제출 #667635

#제출 시각아이디문제언어결과실행 시간메모리
667635Hacv16Table Tennis (info1cup20_tabletennis)C++17
20 / 100
3070 ms5132 KiB
#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) 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; } void bt(int i, int chosen, vector<ll> aux){ if(chosen > n || i > n + k) return; if(i == n + k){ if(chosen == n){ ll sum = aux[0] + aux[aux.size() - 1]; bool isAns = true; for(int l = 1, r = aux.size() - 2; l < r; l++, r--) if(aux[l] + aux[r] != sum){ isAns = false; break; } if(isAns){ for(auto x : aux) cout << x << ' '; cout << '\n'; exit(0); } } return; } vector<ll> sla = aux; sla.push_back(v[i]); bt(i + 1, chosen + 1, sla); bt(i + 1, chosen, aux); } 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); } if(n + k <= 18){ vector<ll> trash; bt(0, 0, trash); return 0; } for(int i = 0; i < v.size(); i++) if(check(i)){ ans = i; break;} for(int i = 0; i < v.size(); i++){ if(i == ans) continue; cout << v[i] << ' '; } cout << '\n'; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

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:75:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |     for(int i = 0; i < v.size(); i++)
      |                    ~~^~~~~~~~~~
tabletennis.cpp:78:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |     for(int i = 0; i < v.size(); i++){
      |                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...