# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
378245 |
2021-03-16T10:25:46 Z |
urd05 |
Meetings (JOI19_meetings) |
C++14 |
|
61 ms |
624 KB |
#include <bits/stdc++.h>
#include "meetings.h"
using namespace std;
mt19937 rd = mt19937((unsigned)chrono::steady_clock::now().time_since_epoch().count());
uniform_int_distribution<int> ran(0, 2147483647);
int s,t;
bool comp(int a,int b) {
if (Query(a,b,t)==b) {
return true;
}
else {
return false;
}
}
void f(vector<int> v) {
if (v.size()==1) {
return;
}
int one=ran(rd)%v.size();
int two=ran(rd)%v.size();
while (one==two) {
two=ran(rd)%v.size();
}
vector<int> save(v.size());
for(int i=0;i<v.size();i++) {
if (i!=one&&i!=two) {
save[i]=Query(v[one],v[two],v[i]);
}
}
save[one]=v[one];
save[two]=v[two];
vector<int> vec;
for(int i=0;i<v.size();i++) {
if (i!=one&&i!=two&&save[i]==v[i]) {
vec.push_back(v[i]);
}
}
s=vec[one];
t=vec[two];
sort(vec.begin(),vec.end(),comp);
vec.insert(vec.begin(),vec[one]);
vec.push_back(vec[two]);
for(int i=0;i+1<vec.size();i++) {
Bridge(min(vec[i],vec[i+1]),max(vec[i],vec[i+1]));
}
vector<vector<int>> val(vec.size());
for(int i=0;i<v.size();i++) {
for(int j=0;j<vec.size();j++) {
if (save[i]==vec[j]) {
val[j].push_back(v[i]);
break;
}
}
}
for(int i=0;i<vec.size();i++) {
f(val[i]);
}
}
void Solve(int n) {
mt19937 rd = mt19937((unsigned)chrono::steady_clock::now().time_since_epoch().count());
uniform_int_distribution<int> ran(0, 2147483647);
vector<int> vec;
for(int i=0;i<n;i++) {
vec.push_back(i);
}
f(vec);
}
Compilation message
meetings.cpp: In function 'void f(std::vector<int>)':
meetings.cpp:28:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
28 | for(int i=0;i<v.size();i++) {
| ~^~~~~~~~~
meetings.cpp:36:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
36 | for(int i=0;i<v.size();i++) {
| ~^~~~~~~~~
meetings.cpp:46:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
46 | for(int i=0;i+1<vec.size();i++) {
| ~~~^~~~~~~~~~~
meetings.cpp:50:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
50 | for(int i=0;i<v.size();i++) {
| ~^~~~~~~~~
meetings.cpp:51:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
51 | for(int j=0;j<vec.size();j++) {
| ~^~~~~~~~~~~
meetings.cpp:58:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
58 | for(int i=0;i<vec.size();i++) {
| ~^~~~~~~~~~~
meetings.cpp: In function 'void Solve(int)':
meetings.cpp:64:13: warning: variable 'rd' set but not used [-Wunused-but-set-variable]
64 | mt19937 rd = mt19937((unsigned)chrono::steady_clock::now().time_since_epoch().count());
| ^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
61 ms |
624 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |