제출 #44831

#제출 시각아이디문제언어결과실행 시간메모리
44831cheater2kDEL13 (info1cup18_del13)C++17
0 / 100
583 ms1692 KiB
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n, q; int a[N], del[N]; vector <int> vres; void solve() { cin >> n >> q; for (int i = 1; i <= q; ++i) cin >> a[i]; a[q + 1] = n + 1; vres.clear(); for (int i = 1; i <= q + 1; ++i) { vector <int> vec; for (int j = a[i - 1] + 1; j < a[i]; ++j) vec.push_back(j); while(vec.size() > 2) { vres.push_back(vec[1]); vec.erase(vec.begin() + 2); vec.erase(vec.begin()); } del[i] = vec.size(); } for (int i = 2; i <= q + 1; ++i) { while(del[i - 1] > 0) { del[i - 1]--; del[i]--; vres.push_back(a[i - 1]); } if (del[i] < 0) { // invalid printf("-1\n"); return; } } if (del[q + 1] > 0) { // invalid printf("-1\n"); return; } printf("%d\n", vres.size()); for (int &i : vres) printf("%d ", i); printf("\n"); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int tt; cin >> tt; while(tt--) { solve(); } }

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

del13.cpp: In function 'void solve()':
del13.cpp:44:28: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
  printf("%d\n", vres.size());
                 ~~~~~~~~~~~^
#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...