제출 #692239

#제출 시각아이디문제언어결과실행 시간메모리
692239Farhan_HYLampice (COCI21_lampice)C++14
0 / 50
1 ms328 KiB
#include <bits/stdc++.h>
#define int long long
#define float double
#define pb push_back
#define F first
#define S second
#define T int t; cin >> t; while(t--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;
/// Benzema is the best player in the world
const int N = 1e6 + 6;
const int M = 1e3 + 3;
const int mod = 1e9 + 7;
const int inf = 1e9;
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const int LOG = 25;
int n, k, a[N];
vector<int> ans, v;

bool check() {
    if (v.size() % k) return 0;
    bool ok = 1;
    for(int i = 0; i < v.size(); i += k) {
        ok &= (begin(v) + i, begin(v) + i + k) == (begin(v), begin(v) + k);
    }
    return ok;
}

main() {
    IOS
    cin >> n >> k;
    for(int i = 1; i <= n; i++) cin >> a[i];
    for(int i = 1; i <= n; i++) {
        for(int j = i; j <= n; j++) {
            v.push_back(i);
            if (check() && v.size() > ans.size()) ans = v;
        }
    }
    cout << ans.size() / k << '\n';
    for(int i = 0; i < k; i++) cout << ans[i] << ' ';
}

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

Main.cpp: In function 'bool check()':
Main.cpp:25:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int i = 0; i < v.size(); i += k) {
      |                    ~~^~~~~~~~~~
Main.cpp: At global scope:
Main.cpp:31:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   31 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...