답안 #1068664

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1068664 2024-08-21T11:15:41 Z PotatoTheWarriorFRTT Lottery (CEOI18_lot) C++14
0 / 100
3000 ms 848 KB
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
ll MOD = 1000000007;
 
ll power(ll x, ll y) {
    ll res = 1;
    while(y != 0) {
        if(y%2) {
            res = (res*x)%MOD;
        }
        x = (x*x)%MOD;
        y/=2;
    }
    return res;
}
 
void solve() {
    int n, l; cin >> n >> l;
    int a[n+1];
    for(int i=0;i<n;i++) {
        int x; cin >> x;
        a[i] = x+10;
    }
    unordered_map<ll, ll> m;
    ll hashes[n+1];
    for(int i=0;i<n-l+1;i++) {
        ll hash = a[i];
        for(int j=1;j<l;j++) {
            hash = power(a[j+i], hash);
        }
        hashes[i] = hash;
        m[hash]++;
    }
 
 
    int q; cin >> q;
    int k; cin >> k; // q=0;k=1;
 
    for(int i=0;i<n-l+1;i++) {
        cout << m[hashes[i]]-1 << " ";
    }
    cout << endl;
 
}
int main()   {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    // int t; cin >> t;
    // while(t--) 
        solve();
 
    char dksfjn;
    cin >> dksfjn;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 600 KB Output is correct
2 Correct 9 ms 568 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 365 ms 848 KB Output is correct
5 Execution timed out 3056 ms 684 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 600 KB Output is correct
2 Correct 9 ms 568 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 365 ms 848 KB Output is correct
5 Execution timed out 3056 ms 684 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -