Submission #874048

# Submission time Handle Problem Language Result Execution time Memory
874048 2023-11-16T08:29:31 Z Sandarach151 Friend (IOI14_friend) C++17
11 / 100
335 ms 65536 KB
#include<bits/stdc++.h>
using namespace std;

int findSample(int n, int confidence[], int host[], int protocol[]){
    set<int> adg[n];
    for(int i=1; i<n; i++){
        if(protocol[i]==0){
            adg[host[i]].insert(i);
            adg[i].insert(host[i]);
        }
        else if(protocol[i]==1){
            for(auto u : adg[host[i]]){
                adg[i].insert(u);
                adg[u].insert(i);
            }
        }
        else{
            for(auto u : adg[host[i]]){
                adg[i].insert(u);
                adg[u].insert(i);
            }
            adg[host[i]].insert(i);
            adg[i].insert(host[i]);
        }
    }
    if(n<=10){
        int maxx = 0;
        for(int mask=0; mask < (1<<n); mask++){
            bool test = true;
            int cur = 0;
            for(int i=0; i<n; i++){
                for(int j=0; j<n; j++){
                    if(((mask & (1<<i))!=0) && ((mask & (1<<j))!=0) && adg[i].count(j)){
                        test = false;
                        break;
                    }
                }
                if(!test){
                    break;
                }
            }
            if(test){
                for(int i=0; i<n; i++){
                    if((mask & (1<<i))!=0){
                        cur+=confidence[i];
                    }
                }
                maxx = max(maxx, cur);
            }
        }
        return maxx;
    }
}

Compilation message

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
   53 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 432 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 35 ms 17872 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Runtime error 1 ms 860 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Runtime error 1 ms 860 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Runtime error 335 ms 65536 KB Execution killed with signal 9
13 Halted 0 ms 0 KB -