QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#597739 | #9347. Competition in Swiss-system | kjhhjki | WA | 0ms | 3608kb | C++20 | 3.3kb | 2024-09-28 18:36:08 | 2024-09-28 18:36:08 |
Judging History
answer
#include <bits//stdc++.h>
using i64 = long long;
using i128 = __int128;
std::ostream& operator<<(std::ostream &os, i128 x)
{
std::string s;
do {
s.push_back(x % 10 + '0');
x /= 10;
}while(x);
std::ranges::reverse(s);
os << s;
return os;
}
i128 gcd(i128 a, i128 b)
{
if(b == 0) {
return a;
}
return gcd(b, a % b);
}
struct fact
{
i128 p, q;
auto operator<=>(const fact &o) const { return p * o.q <=> q * o.p; }
fact(i128 p = 0, i128 q = 1): p(p), q(q)
{
update();
}
void update()
{
i128 g = gcd(p, q);
p /= g; q /= g;
}
constexpr fact operator+(const fact &o) const { return fact(p * o.q + q * o.p, q * o.q); }
constexpr fact operator-(const fact &o) const { return fact(p * o.q - q * o.p, q * o.q); }
constexpr fact operator*(const fact &o) const { return fact(p * o.p, q * o.q); }
constexpr fact operator/(const fact &o) const { return fact(p * o.q, q * o.p); }
constexpr fact& operator+=(const fact &o) { return *this = *this + o; }
constexpr fact& operator-=(const fact &o) { return *this = *this - o; }
constexpr fact& operator*=(const fact &o) { return *this = *this * o; }
constexpr fact& operator/=(const fact &o) { return *this = *this / o; }
friend std::ostream& operator<<(std::ostream &os, const fact &o)
{
if(o < fact(1/ 3)) {
return os << "1/3";
}
return os << o.p << '/' << o.q;
}
};
void solve()
{
int n, m;
std::cin >> n >> m;
std::vector<int> a(m + 1);
for(int i = 1; i <= m; ++i) {
std::cin >> a[i];
}
std::vector<std::vector<int>> oppo(n + 1);
std::vector<int> mp(n + 1), gp(n + 1), cnt(n + 1);
for(int i = 1; i <= m; ++i) {
std::vector<bool> vis(n + 1);
for(int j = 0; j < a[i]; ++j) {
int p1, p2, w1, w2, d;
std::cin >> p1 >> p2 >> w1 >> w2 >> d;
vis[p1] = vis[p2] = true;
gp[p1] += 3 * w1 + d;
gp[p2] += 3 * w2 + d;
if(w1 > w2) {
mp[p1] += 3;
} else if(w1 < w2) {
mp[p2] += 3;
} else {
mp[p1] += 1;
mp[p2] += 1;
}
oppo[p1].push_back(p2);
oppo[p2].push_back(p1);
cnt[p1] += 3 * (w1 + w2 + d);
cnt[p2] += 3 * (w1 + w2 + d);
}
for(int i = 1; i <= n; ++i) {
if(!vis[i]) {
mp[i] += 3;
gp[i] += 6;
cnt[i] += 6;
}
}
std::cout << "Round " << i << '\n';
for(int j = 1; j <= n; ++j) {
fact omw = 0, ogw = 0;
for(auto x: oppo[j]) {
omw += fact(std::max(i, mp[x]), 3 * i);
ogw += fact(std::max(cnt[x] / 3, gp[x]), cnt[x]);
}
if(oppo[j].size()) omw /= oppo[j].size(), ogw /= oppo[j].size();
std::cout << mp[j] << ' ' << omw << ' ' << fact(gp[j], cnt[j]) << ' ' << ogw << '\n';
}
}
}
int main()
{
std::ios::sync_with_stdio(0);
std::cin.tie(0);
int T = 1;
std::cin >> T;
while(T --) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3608kb
input:
2 2 3 0 1 1 1 2 2 0 1 1 2 1 1 1 3 2 1 1 1 2 0 2 0 2 3 2 0 0
output:
Round 1 3 0/1 1/1 0/1 3 0/1 1/1 0/1 Round 2 6 1/2 13/15 7/15 3 1/1 7/15 13/15 Round 3 7 4/9 17/24 11/24 4 7/9 11/24 17/24 Round 1 0 1/1 0/1 1/1 3 1/3 1/1 1/3 3 0/1 1/1 0/1 Round 2 3 1/1 1/2 1/1 6 1/2 1/1 1/2 3 1/1 1/2 1/1
result:
wrong answer 2nd lines differ - expected: '3 1/3 1/1 1/3', found: '3 0/1 1/1 0/1'