QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#664823 | #7157. Bikes vs Cars | spycoderyt# | 0 | 0ms | 3668kb | C++14 | 843b | 2024-10-21 22:34:25 | 2024-10-21 22:34:26 |
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 505;
struct node{
int a,b,w;
bool operator<(const node&x)const{
return w<x.w;
}
};
set<node> v;
int n,m,x,c,b;
int main() {
// try the largest next edge, but before that check if theres already a larger connection
cin>>n>>m;
for(int i = 1;i<n;i++) {
for(int j = 0;j<i;j++) {
cin>>x;
c = x;
v.insert({j,i,m-x});
}
}
for(int i = 1;i<n;i++) {
for(int j = 0;j<i;j++) {
cin>>x;
b = x;
v.insert({j,i,x});
}
}
if(m-c > b || m - b > c) {
cout << "NO";
return 0;
}
cout << v.size() << "\n";
for(auto [a,b,c] : v)cout<<a<<" " << b << " " << c << "\n";
}
/*
2 1
0
1
*/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3668kb
input:
14 1000000 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 49...
output:
2 0 1 505815 0 1 536641
result:
wrong answer The graph is not connected
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #16:
score: 0
Wrong Answer
time: 0ms
memory: 3616kb
input:
14 1000000 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 494185 49...
output:
2 0 1 505815 0 1 536641
result:
wrong answer The graph is not connected
Subtask #4:
score: 0
Wrong Answer
Test #39:
score: 0
Wrong Answer
time: 0ms
memory: 3664kb
input:
163 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 ...
output:
NO
result:
wrong answer Contestant said no, judge found solution
Subtask #5:
score: 0
Skipped
Dependency #2:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%