QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#356899 | #7107. Chaleur | karuna | WA | 115ms | 4252kb | C++20 | 1.0kb | 2024-03-18 15:31:12 | 2024-03-18 15:31:12 |
Judging History
answer
#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
int T;
cin >> T;
while (T--) {
int n, m;
cin >> n >> m;
vector<int> a(n);
for (int i = 0; i < m; i++) {
int u, v;
cin >> u >> v;
a[u - 1]++;
a[v - 1]++;
}
sort(a.rbegin(), a.rend());
for (int t = 0; t < 2; t++) {
for (int k = 1; k < n; k++) {
if (a[k - 1] >= k - 1 && a[k] <= k) {
int x = a[k - 1];
int y = a[k];
int z = (k == n - 1) ? 0 : a[k + 1];
if (y <= k - 1) {
int p = k;
while (p < n && a[p] == k - 1) ++p;
cout << p - k + 1 << ' ';
}
else {
int p = k;
while (p < n && a[p] == k) ++p;
cout << p - k << ' ';
}
break;
}
}
for (int i = 0; i < n; i++) a[i] = n - 1 - a[i];
reverse(a.begin(), a.end());
}
cout << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
input:
3 3 2 1 2 2 3 6 6 1 2 2 3 1 3 1 4 2 5 3 6 4 1 1 2
output:
2 1 1 4 1 2
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 115ms
memory: 4252kb
input:
2231 1 0 5 7 4 1 3 4 3 1 3 5 4 2 3 2 4 5 5 4 2 1 2 5 2 4 2 3 5 10 3 2 2 5 1 4 4 2 4 5 1 2 1 3 3 5 3 4 1 5 5 10 1 3 2 4 1 4 5 2 2 3 1 5 5 4 1 2 3 4 5 3 5 9 2 5 3 5 2 3 2 1 4 3 3 1 4 1 4 5 2 4 5 4 4 2 4 1 4 5 4 3 5 9 4 1 4 5 3 4 2 4 2 1 3 1 2 5 3 5 3 2 5 4 2 5 2 3 2 1 2 4 5 9 5 2 1 3 4 3 1 2 5 4 4 2 5...
output:
3 1 4 1 1 5 1 5 2 1 4 1 2 1 4 1 2 1 2 1 3 1 4 1 4 1 1 5 2 1 4 1 1 5 1 5 1 5 3 1 4 1 4 1 4 1 3 1 3 1 4 1 4 1 2 1 4 1 4 1 1 5 1 5 2 1 4 1 4 1 4 1 3 1 2 1 4 1 2 1 4 1 4 1 4 1 3 1 1 5 4 1 4 1 1 5 2 1 4 1 2 1 2 1 1 5 4 1 1 5 3 1 4 1 1 5 2 1 1 5 ...
result:
wrong answer 1st lines differ - expected: '1 1', found: ''