Submission #493681

# Submission time Handle Problem Language Result Execution time Memory
493681 2021-12-12T14:49:17 Z Torluch Lampice (COCI19_lampice) C++14
0 / 110
1 ms 460 KB
#include <bits/stdc++.h>
using namespace std;
ifstream fin("input.txt");
ofstream fout("output.txt");
int n, k; 
vector<int> v; 
string pattern;
int lung; 


bool pat(int l, int r, int interval){
    string a = ""; 
    string b = ""; 
    for(int i = l; i <= r; i++){
        //fout<<a<<" " << b <<endl; 
        if( i < l + interval) {
            a += to_string(v[i]);
           // b = a; 
            continue; 
        }
        //fout<< "ciao " << i - l << endl;
        if((i - l + 1) % interval != 0) b += to_string(v[i]);
        else {
            
            b += to_string(v[i]);
            if(b != a) return false; 
            else b = ""; 
        }
    }
    // fout<< l << " " << r << " "<< interval<<endl; 
    cout<< interval<< endl; 
    cout<< a; 
    return true; 

}
bool f(int l, int r){
    for( int i = 0; i < n; i++){
        for(int j = 1; j * k < n; j++){
            //fout<< i<< j<< endl;
            if(pat(i, j*k + i - 1, j)) return 0; 
            // if(pat(0, 3, 2)) return 0; 
        }
    }
    cout<<-1; 
    return false; 

}
int main() {

    cin>>n>>k;
    v.resize(n);
    for(int &i : v) cin>>i;
    f(0, n);
 
    
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -