답안 #259911

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
259911 2020-08-08T19:29:59 Z peuch Lottery (CEOI18_lot) C++17
45 / 100
605 ms 32120 KB
#include<bits/stdc++.h>
using namespace std;

const int MAXN = 2010;

int n, l, q;
int v[MAXN];

int intr[MAXN][MAXN];
map<int, vector<int> > marc;

int eql[MAXN][MAXN];

int ans[MAXN][MAXN];

int main(){
	scanf("%d %d", &n, &l);
	for(int i = 1; i <= n; i++)
		scanf("%d", &v[i]);
	for(int i = 1; i <= n - l + 1; i++)
		for(int j = 0; j < l; j++)
			intr[i][j + 1] = v[i + j];
	for(int i = 1; i <= l; i++){
		marc.clear();
		for(int j = 1; j <= n - l + 1; j++)
			marc[intr[j][i]].push_back(j);
		for(int j = 1; j <= n - l + 1; j++)
			for(int k = 0; k < marc[intr[j][i]].size(); k++)
				eql[j][marc[intr[j][i]][k]]++;	
	}
	for(int i = 1; i <= n - l + 1; i++)
		for(int j = 1; j <= n - l + 1; j++){
			if(j == i) continue;
			ans[i][l - eql[i][j]]++;
		}
	for(int i = 1; i <= n - l + 1; i++)
		for(int j = 1; j <= l; j++)
			ans[i][j] += ans[i][j - 1];

	scanf("%d", &q);
	for(int i = 1; i <= q; i++){
		int k;
		scanf("%d", &k);
		for(int i = 1; i <= n - l + 1; i++)
			printf("%d ", ans[i][k]);
		printf("\n");
	}
}

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:28:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int k = 0; k < marc[intr[j][i]].size(); k++)
                   ~~^~~~~~~~~~~~~~~~~~~~~~~~~
lot.cpp:17: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:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &v[i]);
   ~~~~~^~~~~~~~~~~~~
lot.cpp:40:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &q);
  ~~~~~^~~~~~~~~~
lot.cpp:43:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &k);
   ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 1280 KB Output is correct
3 Correct 2 ms 1408 KB Output is correct
4 Correct 2 ms 1024 KB Output is correct
5 Correct 1 ms 1024 KB Output is correct
6 Correct 1 ms 1536 KB Output is correct
7 Correct 1 ms 1408 KB Output is correct
8 Correct 9 ms 2432 KB Output is correct
9 Correct 8 ms 2432 KB Output is correct
10 Correct 5 ms 4096 KB Output is correct
11 Correct 4 ms 4096 KB Output is correct
12 Correct 6 ms 3840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 1280 KB Output is correct
3 Correct 2 ms 1408 KB Output is correct
4 Correct 2 ms 1024 KB Output is correct
5 Correct 1 ms 1024 KB Output is correct
6 Correct 1 ms 1536 KB Output is correct
7 Correct 1 ms 1408 KB Output is correct
8 Correct 9 ms 2432 KB Output is correct
9 Correct 8 ms 2432 KB Output is correct
10 Correct 5 ms 4096 KB Output is correct
11 Correct 4 ms 4096 KB Output is correct
12 Correct 6 ms 3840 KB Output is correct
13 Correct 54 ms 32120 KB Output is correct
14 Correct 426 ms 23544 KB Output is correct
15 Correct 444 ms 28664 KB Output is correct
16 Correct 605 ms 31864 KB Output is correct
17 Correct 311 ms 31344 KB Output is correct
18 Correct 293 ms 31352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 1280 KB Output is correct
3 Correct 2 ms 1408 KB Output is correct
4 Correct 2 ms 1024 KB Output is correct
5 Correct 1 ms 1024 KB Output is correct
6 Correct 1 ms 1536 KB Output is correct
7 Correct 1 ms 1408 KB Output is correct
8 Correct 9 ms 2432 KB Output is correct
9 Correct 8 ms 2432 KB Output is correct
10 Correct 5 ms 4096 KB Output is correct
11 Correct 4 ms 4096 KB Output is correct
12 Correct 6 ms 3840 KB Output is correct
13 Correct 54 ms 32120 KB Output is correct
14 Correct 426 ms 23544 KB Output is correct
15 Correct 444 ms 28664 KB Output is correct
16 Correct 605 ms 31864 KB Output is correct
17 Correct 311 ms 31344 KB Output is correct
18 Correct 293 ms 31352 KB Output is correct
19 Incorrect 1 ms 384 KB Output isn't correct
20 Halted 0 ms 0 KB -