제출 #482580

#제출 시각아이디문제언어결과실행 시간메모리
482580HazemLottery (CEOI18_lot)C++14
20 / 100
149 ms972 KiB
#include <bits/stdc++.h> #define LL long long using namespace std; const int N = 1e4+1; const LL MOD = 1e9+7; int a[N]; LL hashs[N]; map<LL,LL>mp; set<int>st; LL mult(LL a,LL b){ return (a*b)%MOD; } LL add(LL a,LL b){ return (a+b)%MOD; } int main(){ int n,l; scanf("%d%d",&n,&l); for(int i=1;i<=n;i++){ scanf("%d",&a[i]); } for(int i=1;i<=n-l+1;i++){ LL prime = 23,hash = 1,power = 1; for(int j=i;j<=i+l-1;j++) hash = add(hash,mult(a[j],power)),power = mult(power,prime); mp[hash]++; hashs[i] = hash; } for(int i=1;i<=n-l+1;i++) printf("%lld ",mp[hashs[i]]-1); puts(""); }

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

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