# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
131530 |
2019-07-17T08:49:22 Z |
MrTEK |
Meetings (JOI19_meetings) |
C++14 |
|
89 ms |
688 KB |
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> ii;
const int N = 3e2 + 5;
vector <int> v;
int mark[N][N],d[N][N];
void bridge(int x,int y) {
Bridge(min(x,y),max(x,y));
}
void solve(vector <int> v) {
if (v.size() < 2)
return;
if (v.size() == 2) {
// cerr << "3 5 " << v[0] << " " << v[1] << endl;
bridge(v[0],v[1]);
return;
}
// cerr << "Selam oyun baslasin : " << v[0] << endl;
for (int i = 1 ; i < v.size() ; i++) {
if (mark[v[0]][i])
continue;
vector <int> nv;
nv.push_back(i);
mark[v[0]][i] = 1;
for (int j = i + 1 ; j < v.size() ; j++)
if (mark[v[0]][j] == 0) {
int temp = Query(v[0],v[i],v[j]);
if (temp != v[0]) {
mark[v[0]][j] = 1;
nv.push_back(j);
if (temp != v[i])
d[v[0]][i] = 1;
if (temp != v[j])
d[v[0]][j] = 1;
}
}
// cerr << "yeni agac : " << v[0] << " " << v[i] << "\n";
vector <int> nv2;
for (auto j : nv) {
// cerr << v[j] << " ";
if (d[v[0]][j] == 0) {
// cerr << "HOLY BRIDGE " << v[0] << " " << v[j] << endl;
bridge(v[0],v[j]);
}
nv2.push_back(v[j]);
}
// cerr << "\n";
solve(nv2);
}
}
void Solve(int n) {
for (int i = 0 ; i < n ; i++)
v.push_back(i);
solve(v);
}
Compilation message
meetings.cpp: In function 'void solve(std::vector<int>)':
meetings.cpp:26:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 1 ; i < v.size() ; i++) {
~~^~~~~~~~~~
meetings.cpp:32:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int j = i + 1 ; j < v.size() ; j++)
~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Incorrect |
2 ms |
376 KB |
Wrong Answer [4] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Incorrect |
2 ms |
376 KB |
Wrong Answer [4] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Incorrect |
2 ms |
376 KB |
Wrong Answer [4] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
89 ms |
688 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |