답안 #144143

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
144143 2019-08-16T08:03:17 Z Swan Lottery (CEOI18_lot) C++14
25 / 100
73 ms 504 KB
#include <bits/stdc++.h>
#define stop system("pause")
#define INP freopen("input.txt","r",stdin)
#define OUTP freopen("solve1.txt","w",stdout)
using namespace std;

vector<int> seq[400];
vector<int> v;
int n,l;

int val(vector<int>& a,vector<int>& b,int k){
    int res = 0;
    for(int i(0); i < a.size();i++){
        if(a[i]!=b[i])res++;
    }
    return res<=k;
}

void brute(){
    for(int i(0); i < n;i++){
        int r = i+l-1;
        if(r >= n)break;
        for(int j(i);j<=r;j++){
            seq[i].push_back(v[j]);
        }
    }
    int q; cin >> q;
    for(int i(0); i < q;i++){
        int k; cin >> k;
        for(int j(0); j < n-l+1;j++){
            int ans = 0;
            for(int z(0); z < n-l+1;z++){
                if(j == z)continue;
                ans+=val(seq[j],seq[z],k);
            }
            cout << ans << ' ';
        }
        cout << '\n';
    }
}

main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> l;
    for(int i(0); i < n;i++){
        int x; cin >> x;
        v.push_back(x);
    }
    if(n<=300)brute();
    return 0;
}
/*
*/

Compilation message

lot.cpp: In function 'int val(std::vector<int>&, std::vector<int>&, int)':
lot.cpp:13:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i(0); i < a.size();i++){
                   ~~^~~~~~~~~~
lot.cpp: At global scope:
lot.cpp:42:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 73 ms 376 KB Output is correct
9 Correct 72 ms 504 KB Output is correct
10 Correct 35 ms 376 KB Output is correct
11 Correct 31 ms 424 KB Output is correct
12 Correct 53 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 73 ms 376 KB Output is correct
9 Correct 72 ms 504 KB Output is correct
10 Correct 35 ms 376 KB Output is correct
11 Correct 31 ms 424 KB Output is correct
12 Correct 53 ms 376 KB Output is correct
13 Incorrect 2 ms 376 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 73 ms 376 KB Output is correct
9 Correct 72 ms 504 KB Output is correct
10 Correct 35 ms 376 KB Output is correct
11 Correct 31 ms 424 KB Output is correct
12 Correct 53 ms 376 KB Output is correct
13 Incorrect 2 ms 376 KB Output isn't correct
14 Halted 0 ms 0 KB -