Submission #920121

# Submission time Handle Problem Language Result Execution time Memory
920121 2024-02-02T05:01:36 Z Sir_Ahmed_Imran Lottery (CEOI18_lot) C++17
0 / 100
33 ms 63568 KB
                              ///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long 
#define append push_back
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define N 2001
int s[N][N];
int x[N][N];
map<int,vector<int>> a;
void solve(){
    int n,m,o,p,q,r;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>o;
        x[i][0]=n-m;
        a[o].append(i);
    }
    for(auto& i:a){
        o=i.ss.size();
        for(int j=0;j<o;j++){
            for(int k=j+1;k<o;k++){
                for(int l=0;l<m;l++){
                    p=i.ss[j];
                    q=i.ss[k];
                    if(p<=l || q+m-l-1>n)
                        continue;
                    s[p-l][q-l]++;
                    s[q-l][p-l]++;
                    x[p-l][s[q-l][p-l]]++;
                    x[q-l][s[q-l][p-l]]++;
                }
            }
        }
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>o;
        for(int j=1;j<n-m+2;j++)
            cout<<x[j][m-o]<<' ';
        cout<<nl;
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Compilation message

lot.cpp: In function 'void solve()':
lot.cpp:16:19: warning: unused variable 'r' [-Wunused-variable]
   16 |     int n,m,o,p,q,r;
      |                   ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 4440 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 4440 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 33 ms 63568 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 33 ms 63568 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 4440 KB Output isn't correct
3 Halted 0 ms 0 KB -