답안 #859576

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
859576 2023-10-10T10:26:21 Z Tenis0206 Diversity (CEOI21_diversity) C++11
4 / 100
7000 ms 432 KB
#include <bits/stdc++.h>

using namespace std;

const int nmax = 3e5;
const int oo = INT_MAX;

int n,q;
int v[nmax + 5];

bool sel[nmax + 5];

int main()
{
    #ifdef home
    freopen("nr.in","r",stdin);
    freopen("nr.out","w",stdout);
    #endif // home
    cin>>n>>q;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
    }
    sort(v+1,v+n+1);
    int x,y;
    cin>>x>>y;
    int Min = oo;
    do
    {
        int rez = 0;
        for(int i=1;i<=n;i++)
        {
            int nr = 0;
            for(int j=i;j<=n;j++)
            {
                if(!sel[v[j]])
                {
                    ++nr;
                }
                sel[v[j]] = true;
                rez += nr;
            }
            for(int j=i;j<=n;j++)
            {
                sel[v[j]] = false;
            }
        }
        Min = min(Min, rez);
    }
    while(next_permutation(v+1,v+n+1));
    cout<<Min<<'\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 5 ms 348 KB Output is correct
5 Correct 28 ms 420 KB Output is correct
6 Correct 169 ms 348 KB Output is correct
7 Correct 496 ms 420 KB Output is correct
8 Correct 1041 ms 424 KB Output is correct
9 Correct 2013 ms 432 KB Output is correct
10 Correct 4069 ms 428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 7063 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 7063 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 7063 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 5 ms 348 KB Output is correct
5 Correct 28 ms 420 KB Output is correct
6 Correct 169 ms 348 KB Output is correct
7 Correct 496 ms 420 KB Output is correct
8 Correct 1041 ms 424 KB Output is correct
9 Correct 2013 ms 432 KB Output is correct
10 Correct 4069 ms 428 KB Output is correct
11 Execution timed out 7063 ms 344 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 5 ms 348 KB Output is correct
5 Correct 28 ms 420 KB Output is correct
6 Correct 169 ms 348 KB Output is correct
7 Correct 496 ms 420 KB Output is correct
8 Correct 1041 ms 424 KB Output is correct
9 Correct 2013 ms 432 KB Output is correct
10 Correct 4069 ms 428 KB Output is correct
11 Execution timed out 7063 ms 344 KB Time limit exceeded
12 Halted 0 ms 0 KB -