이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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] = power(2, power(3, x));
}
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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |