답안 #118375

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118375 2019-06-18T20:18:45 Z davitmarg Lottery (CEOI18_lot) C++17
45 / 100
527 ms 31864 KB
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <bitset>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(),v.end()
using namespace std;

int n,l,a[10004],cnt[2003][2003],Q,k;
int main()
{
    cin>>n>>l;
    for(int i=1;i<=n;i++)
        scanf("%d",a+i);

    for(int i=1;i<=n-l+1;i++)
        for(int j=i+1;j<=n-l+1;j++)
            for(int p=0;p<l;p++)
                cnt[i][j]+=(a[i+p]!=a[j+p]);

    cin>>Q;
    while(Q--)
    {
        scanf("%d",&k);
        vector<int> ans(n-l+3);
        for(int i=1;i<=n-l+1;i++)
            for(int j=i+1;j<=n-l+1;j++)
            {
                ans[i]+=(cnt[i][j]<=k);
                ans[j]+=(cnt[i][j]<=k);
            }
        for(int i=1;i<=n-l+1;i++)
            printf("%d ",ans[i]);
        printf("\n");
    }

	return 0;
}


/*


*/

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:31:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",a+i);
         ~~~~~^~~~~~~~~~
lot.cpp:41:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&k);
         ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Correct 2 ms 768 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 5 ms 1024 KB Output is correct
9 Correct 5 ms 1024 KB Output is correct
10 Correct 6 ms 1664 KB Output is correct
11 Correct 6 ms 1664 KB Output is correct
12 Correct 6 ms 1664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Correct 2 ms 768 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 5 ms 1024 KB Output is correct
9 Correct 5 ms 1024 KB Output is correct
10 Correct 6 ms 1664 KB Output is correct
11 Correct 6 ms 1664 KB Output is correct
12 Correct 6 ms 1664 KB Output is correct
13 Correct 49 ms 14080 KB Output is correct
14 Correct 527 ms 8972 KB Output is correct
15 Correct 506 ms 9164 KB Output is correct
16 Correct 380 ms 12652 KB Output is correct
17 Correct 461 ms 11712 KB Output is correct
18 Correct 457 ms 11732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 83 ms 31864 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 83 ms 31864 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 640 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Correct 2 ms 768 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 5 ms 1024 KB Output is correct
9 Correct 5 ms 1024 KB Output is correct
10 Correct 6 ms 1664 KB Output is correct
11 Correct 6 ms 1664 KB Output is correct
12 Correct 6 ms 1664 KB Output is correct
13 Correct 49 ms 14080 KB Output is correct
14 Correct 527 ms 8972 KB Output is correct
15 Correct 506 ms 9164 KB Output is correct
16 Correct 380 ms 12652 KB Output is correct
17 Correct 461 ms 11712 KB Output is correct
18 Correct 457 ms 11732 KB Output is correct
19 Runtime error 83 ms 31864 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Halted 0 ms 0 KB -