Submission #521028

# Submission time Handle Problem Language Result Execution time Memory
521028 2022-01-31T15:49:08 Z FulopMate Friend (IOI14_friend) C++17
11 / 100
1000 ms 3908 KB
#include "friend.h"

#include <bits/stdc++.h>

using namespace std;

int findSample(int n, int confidence[], int host[], int protocol[]){
    bool v[10][10];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            v[i][j] = 0;
        }
    }
    for(int i = 0; i < 10; i++)v[i][i] = 1;
    for(int i = 1; i < n; i++){
        int h = host[i];
        if(protocol[i] == 0){
            v[h][i] = v[i][h] = 1;
        } else if(protocol[i] == 2){ // We
            for(int j = 0; j < n; j++){
                if(v[h][j]) v[i][j] = v[j][i] = 1;
            }
        } else { //MyFriends
            for(int j = 0; j < n; j++){
                if(j != h && v[h][j]) v[i][j] = v[j][i] = 1;
            }
        }
    }
    int r = 0;
    for(int i = 0; i < (1<<n); i++){
        int c = 0;
        for(int j = 0; j < n; j++){
            if(i & (1<<j))c += confidence[j];
        }
        bool b = 1;
        for(int j = 0; j < n; j++){
            for(int k = 0; k < n; k++){
                if(j != k && (i &(1<<j)) && (i &(1<<k)) && v[j][k])
                    b = 0;
            }
        }
        if(b)r = max(r, c);
    }
    return r;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 629 ms 420 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Runtime error 1 ms 332 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Runtime error 1 ms 344 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Runtime error 25 ms 3908 KB Execution killed with signal 11
13 Halted 0 ms 0 KB -