제출 #530923

#제출 시각아이디문제언어결과실행 시간메모리
530923ivlsLampice (COCI21_lampice)C++14
50 / 50
1 ms320 KiB
#include <bits/stdc++.h> using namespace std; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); using ll = long long; const int inf = 2e9; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; for (int l = 0; l < n; l++) for (int r = l; r < n; r++) if ((r - l + 1) % k == 0) { set<vector<int>> p; vector<int> cur; for (int i = l; i <= r; i++) { cur.push_back(a[i]); if (cur.size() == (r - l + 1) / k) { p.insert(cur); cur.clear(); } } if (p.size() == 1) { cout << (*p.begin()).size() << "\n"; for (auto u : *p.begin()) cout << u << " "; return 0; } } cout << -1; }

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

Main.cpp: In function 'int main()':
Main.cpp:27:36: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |                     if (cur.size() == (r - l + 1) / k)
      |                         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...