제출 #1060169

#제출 시각아이디문제언어결과실행 시간메모리
1060169user736482Lottery (CEOI18_lot)C++17
80 / 100
3087 ms4188 KiB
#include<bits/stdc++.h> using namespace std; int n,q,a,k,l; vector<int>v,poz,pom;//duze jedno do usuniecia int pod[10007]; int licz[107][10007]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>l; for(int i=0;i<n;i++){ cin>>a; v.push_back(a); } cin>>q; for(int i=0;i<q;i++){ cin>>k; k=l-k; pom.push_back(k); } 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++){ for(int s=0;s<q;s++){ k=pom[s]; if(pod[-i+j]>=k){ licz[s][i-l+1]++; licz[s][j-l+1]++; } } } } for(int i=0;i<q;i++){ for(int j=0;j<n-l+1;j++){ cout<<licz[i][j]<<" "; } cout<<"\n"; } }

컴파일 시 표준 에러 (stderr) 메시지

lot.cpp: In function 'int main()':
lot.cpp:31:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             for(int j=0;j<poz.size();j++){
      |                         ~^~~~~~~~~~~
lot.cpp:42:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |             for(int j=0;j<poz.size();j++){
      |                         ~^~~~~~~~~~~
lot.cpp:50:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |             for(int j=0;j<poz.size();j++){
      |                         ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...