답안 #168950

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
168950 2019-12-17T09:34:11 Z kostia244 Lottery (CEOI18_lot) C++17
45 / 100
68 ms 32436 KB
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
// using vi vector<int>;
const int maxn = 2222;
int n, l, q, x;
int a[maxn], mat[maxn][maxn], cnt[maxn][maxn];
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> l;
    for(int i = 1; i <= n; i++) cin >> a[i];
    for(int i = 1; i <= n; i++)
    for(int j = i+1; j <= n; j++) {
    	if(a[i]==a[j]) continue;
        int diff = j-i;
        int L = max(j-l+1, 1+diff);
        int R = min(j, n-l+1);
        // cout << i << " " << j << " : " << L << " " << R << "\n";
      if(L<=R){
        ++mat[diff][L];
        --mat[diff][R+1];}
    }
    for(int i = 1; i <= n; i++) {
        ll cur = 0;
        for(int j = i+1; j <= n-l+1; j++) {
            cur += mat[i][j];
            // cout << j << " " << j-i << " " << cur << "\n";
            ++cnt[j][cur];
            ++cnt[j-i][cur];
        }
    }
    for(int i = 1; i <= n-l+1; i++) {
        for(int j = 1; j <= n; j++) {
            cnt[i][j] += cnt[i][j-1];
        }
    }
    cin >> q;
    while(q--) {
        cin >> x;
        for(int i = 1; i <= n-l+1; i++) cout << cnt[i][x] << " ";cout << "\n";
    }
}

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:44:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
         for(int i = 1; i <= n-l+1; i++) cout << cnt[i][x] << " ";cout << "\n";
         ^~~
lot.cpp:44:66: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
         for(int i = 1; i <= n-l+1; i++) cout << cnt[i][x] << " ";cout << "\n";
                                                                  ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 888 KB Output is correct
3 Correct 2 ms 1016 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 3 ms 1144 KB Output is correct
7 Correct 2 ms 1016 KB Output is correct
8 Correct 4 ms 1784 KB Output is correct
9 Correct 4 ms 1792 KB Output is correct
10 Correct 5 ms 3192 KB Output is correct
11 Correct 5 ms 3192 KB Output is correct
12 Correct 5 ms 2940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 888 KB Output is correct
3 Correct 2 ms 1016 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 3 ms 1144 KB Output is correct
7 Correct 2 ms 1016 KB Output is correct
8 Correct 4 ms 1784 KB Output is correct
9 Correct 4 ms 1792 KB Output is correct
10 Correct 5 ms 3192 KB Output is correct
11 Correct 5 ms 3192 KB Output is correct
12 Correct 5 ms 2940 KB Output is correct
13 Correct 68 ms 32436 KB Output is correct
14 Correct 46 ms 20856 KB Output is correct
15 Correct 49 ms 20844 KB Output is correct
16 Correct 66 ms 28664 KB Output is correct
17 Correct 63 ms 26616 KB Output is correct
18 Correct 60 ms 26744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 888 KB Output is correct
3 Correct 2 ms 1016 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 3 ms 1144 KB Output is correct
7 Correct 2 ms 1016 KB Output is correct
8 Correct 4 ms 1784 KB Output is correct
9 Correct 4 ms 1792 KB Output is correct
10 Correct 5 ms 3192 KB Output is correct
11 Correct 5 ms 3192 KB Output is correct
12 Correct 5 ms 2940 KB Output is correct
13 Correct 68 ms 32436 KB Output is correct
14 Correct 46 ms 20856 KB Output is correct
15 Correct 49 ms 20844 KB Output is correct
16 Correct 66 ms 28664 KB Output is correct
17 Correct 63 ms 26616 KB Output is correct
18 Correct 60 ms 26744 KB Output is correct
19 Incorrect 2 ms 380 KB Output isn't correct
20 Halted 0 ms 0 KB -