Submission #692239

# Submission time Handle Problem Language Result Execution time Memory
692239 2023-02-01T08:43:42 Z Farhan_HY Lampice (COCI21_lampice) C++14
0 / 50
1 ms 328 KB
#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] << ' ';
}

Compilation message

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 time Memory Grader output
1 Incorrect 1 ms 328 KB Sequence doesn't repeat k times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 324 KB Sequence doesn't repeat k times
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Sequence doesn't repeat k times
2 Halted 0 ms 0 KB -