답안 #118374

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118374 2019-06-18T20:17:17 Z davitmarg Lottery (CEOI18_lot) C++17
0 / 100
57 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 Incorrect 2 ms 640 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 640 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 57 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 57 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 Incorrect 2 ms 640 KB Output isn't correct
3 Halted 0 ms 0 KB -