QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#159411 | #7107. Chaleur | ucup-team1516# | AC ✓ | 151ms | 7912kb | C++17 | 1.8kb | 2023-09-02 17:53:55 | 2023-09-02 17:53:56 |
Judging History
answer
#include <string.h>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while(t--) {
int n,m;
cin >> n >> m;
vector<int>cnt(n),res;
vector<vector<int>>road(n);
for(int i = 0; i < m; i++) {
int a,b;
cin >> a >> b;
a--;
b--;
road[a].push_back(b);
road[b].push_back(a);
cnt[a]++;
cnt[b]++;
}
res = cnt;
sort(cnt.begin(),cnt.end());
int s = 1;
for(int i = 0; i < n; i++) {
int a = n-i;
s = max(s,min(a,cnt[i]+1));
}
int a = 0,b = 0,c = 0;
for(int i = 0; i < n; i++) {
if(cnt[i] == s-1) {
a++;
}
if(cnt[i] == s) {
c++;
}
if(cnt[i] > s) {
b++;
}
}
if(m == 0) {
cout << n << " " << 1 << endl;
}
else if(b+c == 0) {
cout << 1 << " " << a << endl;
}
else if(b+c == s) {
cout << a+b+c-s+1 << " " << c+1 << endl;
}
else {
cout << a+b+c-s+1 << " " << s-b-c << endl;
}
}
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3680kb
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: 0
Accepted
time: 151ms
memory: 7912kb
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:
1 1 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 3 1 3 1 1 5 3 1 3 1 2 1 1 5 4 1 3 1 1 5 2 1 3 1 2 1 2 1 ...
result:
ok 2231 lines
Extra Test:
score: 0
Extra Test Passed