제출 #483337

#제출 시각아이디문제언어결과실행 시간메모리
483337MOUF_MAHMALATLottery (CEOI18_lot)C++14
45 / 100
3099 ms556 KiB
#include<bits/stdc++.h> #define all(s) s.begin(),s.end() #define F first #define S second using namespace std; typedef int ll; const ll mod=1e9+7; ll n,l,q,o,a[10001],c[10001],x,ans,sz[10001]; map<ll,ll>mp; vector<vector<ll> >v; void best() { } int main() { ios_base::sync_with_stdio(0); cin.tie(0),cout.tie(0); scanf("%d%d",&n,&l); for(ll i=0; i<n; i++) { scanf("%d",&a[i]); if(!mp[a[i]]) mp[a[i]]=++o; a[i]=mp[a[i]]; } mp.clear(); v.resize(o+1); for(ll i=0; i<n; i++) v[a[i]].push_back(i),sz[a[i]]++; scanf("%d",&q); while(q--) { scanf("%d",&x); x=l-x; for(ll i=0; i+l-1<n; i++) { ans=0; memset(c,0,sizeof c); for(ll j=i; j<i+l; j++) for(ll k=0; k<sz[a[j]]; k++) { if(v[a[j]][k]-j+i>=0) c[v[a[j]][k]-j+i]++; } for(ll j=0; j+l-1<n; j++) if(i!=j) ans+=(c[j]>=x); printf("%d ",ans); } printf("\n"); } return 0; }

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

lot.cpp: In function 'int main()':
lot.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     scanf("%d%d",&n,&l);
      |     ~~~~~^~~~~~~~~~~~~~
lot.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         scanf("%d",&a[i]);
      |         ~~~~~^~~~~~~~~~~~
lot.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |     scanf("%d",&q);
      |     ~~~~~^~~~~~~~~
lot.cpp:34:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |         scanf("%d",&x);
      |         ~~~~~^~~~~~~~~
#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...