제출 #260005

#제출 시각아이디문제언어결과실행 시간메모리
260005ly20Lottery (CEOI18_lot)C++17
45 / 100
107 ms65536 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 11234; int eq[MAXN][MAXN], resp[MAXN][MAXN]; int v[MAXN]; int main() { int n, l; scanf("%d %d", &n, &l); int id = n - l + 1; for(int i = 0; i < n; i++) { scanf("%d", &v[i]); for(int j = 0; j < i; j++) { if(v[i] != v[j]) continue; int ini1 = i - l + 1, fim1 = i, ini2 = j - l + 1, fim2 = j; int mn = min(ini1, ini2); if(mn < 0) { ini1 -= mn; ini2 -= mn; } int mx = max(fim1, fim2); eq[ini1][ini2]++; eq[ini2][ini1]++; if(fim1 + 1 < id && fim2 + 1 < id) { eq[fim1 + 1][fim2 + 1]--; eq[fim2 + 1][fim1 + 1]--; } //printf("%d %d %d %d\n", ini1, ini2, fim1, fim2); } } for(int i = 1; i < id; i++) { for(int j = 1; j < id; j++) { eq[i][j] += eq[i - 1][j - 1]; } } for(int i = 0; i < id; i++) { for(int j = 0; j < id; j++) { if(i == j) continue; //printf("%d %d %d\n", i, j, eq[i][j]); resp[i][l - eq[i][j]]++; } } for(int i = 0; i < id; i++) { for(int j = 1; j <= l; j++) { resp[i][j] += resp[i][j - 1]; } } int q; scanf("%d", &q); for(int i = 0; i < q; i++) { int r; scanf("%d", &r); for(int j = 0; j < id; j++) { printf("%d ", resp[j][r]); } printf("\n"); } return 0; }

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

lot.cpp: In function 'int main()':
lot.cpp:19:8: warning: unused variable 'mx' [-Wunused-variable]
    int mx = max(fim1, fim2);
        ^~
lot.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &l);
  ~~~~~^~~~~~~~~~~~~~~~~
lot.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &v[i]);
   ~~~~~^~~~~~~~~~~~~
lot.cpp:47:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &q);
  ~~~~~^~~~~~~~~~
lot.cpp:50:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &r);
   ~~~~~^~~~~~~~~~
#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...