Submission #322383

# Submission time Handle Problem Language Result Execution time Memory
322383 2020-11-14T14:39:50 Z Karen124 Lottery (CEOI18_lot) C++14
25 / 100
15 ms 4588 KB
#include <bits/stdc++.h>
     
using namespace std;
     
#define ll long long int 
#define F first
#define S second
#define pb push_back
 
const ll N = 300 + 10;
const ll LOG = 50;
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 10;
int n, q, len, a[N], Q[N];
vector <int> all[N][N];
int main() {
    cin >> n >> len;
    if (n <= 300){
        for (int i = 1; i <= n; i++) cin >> a[i];
        for (int i = 1; i <= n - len + 1; i++){
            for (int j = 1; j <= n - len + 1; j++){
                if (i == j) continue;
                int dif = 0;
                for (int k = 0; k < len; k++){
                    dif += (a[i + k] != a[j + k]);
                }
                for (int k = dif; k <= len; k++) all[i][k].pb(j);
            }
        }
        for (int i = 1; i <= n - len + 1; i++){
            for (int j = 0; j <= len; j++){
                sort(all[i][j].begin(), all[i][j].end());
                all[i][j].resize(unique(all[i][j].begin(), all[i][j].end()) - all[i][j].begin());
            }
        }
        cin >> q;
        for (int i = 0; i < q; i++){
            cin >> Q[i];
        }
        for (int i = 0; i < q; i++){
            for (int j = 1; j <= n - len + 1; j ++){
                cout << all[j][Q[i]].size() << ' ';
            }
            cout << '\n';
        }
    }
    else return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB Output is correct
2 Correct 3 ms 2668 KB Output is correct
3 Correct 4 ms 2796 KB Output is correct
4 Correct 4 ms 2668 KB Output is correct
5 Correct 3 ms 2676 KB Output is correct
6 Correct 3 ms 2668 KB Output is correct
7 Correct 4 ms 2796 KB Output is correct
8 Correct 9 ms 3436 KB Output is correct
9 Correct 15 ms 4588 KB Output is correct
10 Correct 8 ms 3692 KB Output is correct
11 Correct 7 ms 3308 KB Output is correct
12 Correct 9 ms 3436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB Output is correct
2 Correct 3 ms 2668 KB Output is correct
3 Correct 4 ms 2796 KB Output is correct
4 Correct 4 ms 2668 KB Output is correct
5 Correct 3 ms 2676 KB Output is correct
6 Correct 3 ms 2668 KB Output is correct
7 Correct 4 ms 2796 KB Output is correct
8 Correct 9 ms 3436 KB Output is correct
9 Correct 15 ms 4588 KB Output is correct
10 Correct 8 ms 3692 KB Output is correct
11 Correct 7 ms 3308 KB Output is correct
12 Correct 9 ms 3436 KB Output is correct
13 Incorrect 2 ms 2540 KB Output isn't correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB Output is correct
2 Correct 3 ms 2668 KB Output is correct
3 Correct 4 ms 2796 KB Output is correct
4 Correct 4 ms 2668 KB Output is correct
5 Correct 3 ms 2676 KB Output is correct
6 Correct 3 ms 2668 KB Output is correct
7 Correct 4 ms 2796 KB Output is correct
8 Correct 9 ms 3436 KB Output is correct
9 Correct 15 ms 4588 KB Output is correct
10 Correct 8 ms 3692 KB Output is correct
11 Correct 7 ms 3308 KB Output is correct
12 Correct 9 ms 3436 KB Output is correct
13 Incorrect 2 ms 2540 KB Output isn't correct
14 Halted 0 ms 0 KB -