# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
366577 |
2021-02-14T15:46:21 Z |
maozkurt |
Mag (COCI16_mag) |
C++17 |
|
383 ms |
85484 KB |
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <numeric>
#include <cassert>
#define endl '\n'
#define sp ' '
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn = 1e6+5;
const int inf = 1e9;
vector<int> adj[maxn];
int magic[maxn];
bool visited[maxn];
int dfs1(int v){
int ret = 1;
for(int i : adj[v]){
if(magic[i] == 1 && !visited[i]){
visited[i] = true;
ret += dfs1(i);
}
}
return ret;
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);cerr.tie(nullptr);
int n;cin>>n;
for(int i=0;i<n-1;i++){
int a,b;cin>>a>>b;
adj[a].pb(b);
adj[b].pb(a);
}
int minn = inf;
for(int i=1;i<=n;i++){
cin>>magic[i];
minn = min(minn, magic[i]);
}
if(minn != 1){
cout << minn << '/' << 1 << endl;
exit(0);
}
int maxx = 0;
for(int i=1;i<=n;i++){
if(!visited[i] && magic[i] == 1){
visited[i] = true;
maxx = max(maxx, dfs1(i));
}
}
cout << 1 << '/' << maxx << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
23916 KB |
Output is correct |
2 |
Correct |
15 ms |
23916 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
23916 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
320 ms |
85484 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
23788 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
383 ms |
77076 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
369 ms |
75244 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
366 ms |
77148 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
71 ms |
28908 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
351 ms |
73580 KB |
Output is correct |
2 |
Incorrect |
366 ms |
76368 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
378 ms |
75596 KB |
Output is correct |
2 |
Incorrect |
305 ms |
50200 KB |
Output isn't correct |