Submission #1086172

# Submission time Handle Problem Language Result Execution time Memory
1086172 2024-09-09T16:39:17 Z dwuy Lottery (CEOI18_lot) C++14
25 / 100
1 ms 604 KB
/**         - dwuy -

      />    フ
      |  _  _|
      /`ミ _x ノ
     /      |
    /   ヽ   ?
 / ̄|   | | |
 | ( ̄ヽ__ヽ_)_)
 \二つ

**/
#include <bits/stdc++.h>

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define file(a) freopen(a".inp","r",stdin); freopen(a".out", "w",stdout)
#define fi first
#define se second
#define endl "\n"
#define len(s) (int)((s).size())
#define MASK(k)(1LL<<(k))
#define TASK "test"

using namespace std;

typedef tuple<int, int, int> tpiii;
typedef pair<double, double> pdd;
typedef pair<int, int> pii;
typedef long long ll;

const long long OO = 1e18;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MX = 1003;

int n, ln, q;
int a[MX];  
int qr[MX];
int id[MX];
int ans[MX][103];
vector<int> rv;

void nhap(){
    cin >> n >> ln;
    for(int i=1; i<=n; i++) cin >> a[i];
    cin >> q;
    for(int i=1; i<=q; i++){
        cin >> qr[i];
        rv.push_back(qr[i]);
    }
    sort(rv.begin(), rv.end());
    rv.erase(unique(rv.begin(), rv.end()), rv.end());
}

void solve(){
    id[n+1] = 101;
    for(int i=0; i<len(rv); i++) id[rv[i]] = i + 1;
    for(int i=n; i>=0; i--) id[i] = id[i]? id[i] : id[i+1];
    for(int i=ln + 1; i<=n; i++){
        int cur = 0;
        for(int j=1; j<=ln; j++) cur += a[j] != a[i - ln + j];
        ans[ln][id[cur]]++;
        ans[i][id[cur]]++;
        for(int j=i+1; j<=n; j++){
            cur += a[j] != a[ln + j - i];
            cur -= a[j - ln] != a[j - i];
            ans[ln + j - i][id[cur]]++;
            ans[j][id[cur]]++;
        }
    }
    for(int i=1; i<103; i++){
        for(int j=1; j<=n; j++) ans[j][i] += ans[j][i-1];
    }
    for(int j=1; j<=q; j++){
        for(int i=ln; i<=n; i++) cout << ans[i][id[qr[j]]] << ' ';
        cout << endl;
    }
}

int32_t main(){
    fastIO;
    //file(TASK);

    nhap();
    solve();

    return 0;
}

/*

9 3
1 2 3 1 2 3 1 2 3
1
1

*/

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 468 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 468 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Incorrect 1 ms 348 KB Output isn't correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 468 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Incorrect 1 ms 348 KB Output isn't correct
14 Halted 0 ms 0 KB -