답안 #920104

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
920104 2024-02-02T04:30:18 Z Muhammad_Aneeq Lottery (CEOI18_lot) C++17
45 / 100
3000 ms 600 KB
/*
بسم الله الرحمن الرحيم
Author:
                          (:Muhammad Aneeq:)
*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
inline void solve()
{   
    int n,l;
    cin>>n>>l;
    int a[n];
    for (auto &i:a)
        cin>>i;
    int q;
    cin>>q;
    int qu[q];
    for (auto& i:qu)
        cin>>i;
    if (q==1&&qu==0)
    {
        set<int>s;
        int ans[n-l+1]={};
        for (int i=0;i<=n-l;i++)
            s.insert(i);
        while (s.size())
        {
            vector<int>z;
            int f=*begin(s);
            for (auto i:s)
            {
                if (f==i)
                    continue;
                bool w=0;
                for (int k=0;k<l&&!w;k++)
                    if (a[f+k]!=a[i+k])
                        w=1;
                if (w==0)
                    z.push_back(i);
            }
            z.push_back(f);
            for (auto i:z)
            {
                ans[i]=z.size()-1;
                s.erase(i);
            }
        }
        for (auto i:ans)
            cout<<i<<' ';
        cout<<endl;
    }
    int ans[q][n-l+1]={};
    for (int i=0;i<=n-l;i++)
    {
        for (int j=i+1;j<=n-l;j++)
        {
            int z=0;
            for (int f=0;f<l;f++)
            {
                if (a[i+f]!=a[j+f])
                    z++;
            }
            for (int f=0;f<q;f++)
                if (qu[f]>=z)
                {
                    ans[f][i]++;
                    ans[f][j]++;
                }
        }
    }
    for (int i=0;i<q;i++)
        for (int j=0;j<=n-l;j++)
            cout<<ans[i][j]<<(j==n-l?'\n':' ');
}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
        solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 21 ms 492 KB Output is correct
14 Correct 206 ms 544 KB Output is correct
15 Correct 211 ms 344 KB Output is correct
16 Correct 160 ms 592 KB Output is correct
17 Correct 175 ms 592 KB Output is correct
18 Correct 182 ms 564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 334 ms 508 KB Output is correct
2 Correct 630 ms 344 KB Output is correct
3 Correct 215 ms 592 KB Output is correct
4 Execution timed out 3039 ms 512 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 334 ms 508 KB Output is correct
2 Correct 630 ms 344 KB Output is correct
3 Correct 215 ms 592 KB Output is correct
4 Execution timed out 3039 ms 512 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 21 ms 492 KB Output is correct
14 Correct 206 ms 544 KB Output is correct
15 Correct 211 ms 344 KB Output is correct
16 Correct 160 ms 592 KB Output is correct
17 Correct 175 ms 592 KB Output is correct
18 Correct 182 ms 564 KB Output is correct
19 Correct 334 ms 508 KB Output is correct
20 Correct 630 ms 344 KB Output is correct
21 Correct 215 ms 592 KB Output is correct
22 Execution timed out 3039 ms 512 KB Time limit exceeded
23 Halted 0 ms 0 KB -