제출 #475191

#제출 시각아이디문제언어결과실행 시간메모리
475191bigoTable Tennis (info1cup20_tabletennis)C++14
0 / 100
70 ms884 KiB
#include <bits/stdc++.h> #include <cmath> using namespace std; int main() { int n, k; cin >> n >> k; vector<int>vec(n + k); for (int i = 0; i < n + k; i++) cin >> vec[i]; int ans=1; int max1 = 0; int pla; vector<bool>vec1(n + k, false); for (int i = 0; i < n + k - 1; i++) { if (vec[i + 1] == vec[i] + 1) { ans++; max1 = max(max1, ans); vec1[i] = true; vec1[i + 1] = true; } else ans = 1; } max1 = min(max1, n); int cnt = 0; for (int i = 0; i < max1; i++) { if (vec1[i]) cnt++; } if (cnt == max1) { for (int j = 0; j <= max1 - 1; j++) cout << vec[j] << " "; } else { for (int i = 1; i <= n + k - max1; i++) { if (vec1[i - 1]) cnt--; if (vec1[i + max1 - 1]) cnt++; if (cnt == max1) { for (int j = i; j <= i + max1 - 1; j++) cout << vec[j] << " "; break; } } } }

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

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:12:6: warning: unused variable 'pla' [-Wunused-variable]
   12 |  int pla;
      |      ^~~
#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...