# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1060161 | user736482 | Lottery (CEOI18_lot) | C++17 | 3084 ms | 1004 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int n,q,a,k,l;
vector<int>v,poz,match[10007];//duze jedno do usuniecia
int pod[10007];
int main(){
cin>>n>>l;
for(int i=0;i<n;i++){
cin>>a;
v.push_back(a);
}
cin>>q;
while(q--){
int licz[n-l+1];
for(int b=0;b<n-l+1;b++)
licz[b]=0;
cin>>k;
k=l-k;
for(int i=0;i<10007;i++)
pod[i]=0;
for(int i=0;i<l-1;i++){
poz.clear();
for(int j=i+1;j<n;j++){
if(v[i]==v[j]) poz.push_back(j);
}
for(int j=0;j<poz.size();j++){
pod[-i+poz[j]]++;
}
}
for(int i=l-1;i<n;i++){
if(i!=l-1){
poz.clear();
i=i-l;
for(int j=i+1;j<n;j++){
if(v[i]==v[j]) poz.push_back(j);
}
for(int j=0;j<poz.size();j++){
pod[-i+poz[j]]--;
}
i=i+l;}
poz.clear();
for(int j=i+1;j<n;j++){
if(v[i]==v[j]) poz.push_back(j);
}
for(int j=0;j<poz.size();j++){
pod[-i+poz[j]]++;
}
//for(int j=l-1;j<i;j++) cout<<0<<" ";
//for(int j=i;j<n;j++)
//cout<<pod[-i+j]<<" ";
for(int j=i+1;j<n;j++){
if(pod[-i+j]>=k){
licz[i-l+1]++;
licz[j-l+1]++;
}
//match[i-l+1].push_back(pod[-i+j]);
//match[j-l+1].push_back(pod[-i+j]);
}
}
for(int i=0;i<n-l+1;i++)
cout<<licz[i]<<" ";
cout<<"\n";
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |