답안 #499740

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499740 2021-12-29T11:37:22 Z Haboosh915 Lampice (COCI21_lampice) C++17
25 / 50
1 ms 276 KB
#include <bits/stdc++.h>

using namespace std;

#define ss second
#define ff first
#define ll long long

int s[53] , v[53] ;
int z = 0 , x = 0 ;
bool el ( ) {
    for ( int i = 1 ; i <= x ; i ++ ) {
        if ( s[i] != v[i] ) return 0 ;
    }
    return 1 ;
}

int main(){

        int n , k ; cin >> n >> k ;
        int a[n+3] ;

        for (int i = 1 ; i <= n ; i ++ ) cin >> a[i] ;

        for ( int num = 1 ; num <= n ; num ++ ) {

            for ( int debut = 1 ; debut <= n-num+1 ; debut ++ ) {

                    memset ( s , 0 , sizeof (s) ) ; z = 0 ;
                for ( int i = debut ; z != num ; i ++ ) {
                    z ++ ;
                    s[z] = a[i] ;
                }
                int ans = 1 ; x = 0 ;

                for ( int i = debut + num ; i <= n ; i ++ ) {
                   x ++ ; v[x] = a[i] ;
                    if ( x == num ) {
                        if ( el () ) {
                            ans ++ ;  memset ( v , 0 , sizeof (v) ) ; x = 0 ;
                            if ( ans == k ) {
                                cout << num << endl ;
                                for (int h = 1 ; h <= z ; h ++ ) {
                                    cout << s[h] << ' ' ;
                                }
                                return 0 ;
                            }
                        }
                        else break ;
                    }
                }
            }
        }
        cout << -1 ;

    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 276 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 276 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Incorrect 1 ms 204 KB Output isn't correct
27 Halted 0 ms 0 KB -