QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#785463 | #9557. Temperance | tizzytyt | RE | 0ms | 3552kb | C++20 | 2.5kb | 2024-11-26 18:01:24 | 2024-11-26 18:01:28 |
Judging History
answer
#define _CRT_SECURE_NO_WARNINGS 1
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
typedef long long i64;
typedef long double ld;
#define endl "\n"
#define all(a) a.begin(), a.end()
#define int i64
typedef std::pair<int, int> PII;
const int N = 2e5 + 10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
long long fast_power(i64 a, i64 b, i64 v = mod) {
i64 sum = 1;
a = a % v;
while (b) {
if (b & 1) {
sum = sum * a % v;
}
a = (a * a) % v;
b >>= 1;
}
return sum;
}
int lowbit(int x) {
return x & -x;
}
bool is_prime(int n){
if(n < 2) return false;
for(int i = 2;i <= n / i;i ++){
if(n % i == 0){
return false;
}
}
return true;
}
int inv(int x, int m = mod) {
return fast_power(x, m - 2, m);
}
struct node {
int x, y, z;
int tmp;
};
void solve(){
int n;
std::cin >> n;
std::vector<node> a(n + 1);
std::map<int, int> mp1;
std::map<int, int> mp2;
std::map<int, int> mp3;
for(int i = 1; i <= n; i++) {
std::cin >> a[i].x >> a[i].y >> a[i].z;
mp1[a[i].x]++;
mp2[a[i].y]++;
mp3[a[i].z]++;
}
std::map<int, int> mpp;
for(int i = 1; i <= n; i++) {
a[i].tmp = std::max({mp1[a[i].x], mp2[a[i].y], mp3[a[i].z]}) - 1;
mpp[a[i].tmp]++;
}
// for(int i = 1; i <= n; i++) {
// std::cout << a[i].tmp << " ";
// }
// std::cout << "\n";
std::vector<int> ans(n);
for(auto [x, y] : mpp) {
// std::cout << x << " " << y << "\n";
ans[x + 1] += y;
}
int cnt = 0;
for(int i = 1; i <= n; i++) {
if(a[i].tmp == 0) {
cnt++;
}
}
ans[0] = 0;
for(int i = 0; i < n; i++) {
if(ans[i] == 0 and i > 0) {
ans[i] = ans[i - 1];
continue;
}
else if(ans[i] != 0) {
ans[i] = ans[i - 1] + ans[i];
}
}
for(int i = 0; i < n; i++) {
std::cout << ans[i] << " ";
}
std::cout << "\n";
}
signed main() {
#ifndef ONLINE_JUDGE
freopen("D:/vsc/c/.cph/in.txt", "r", stdin);
// freopen("D:/vsc/c/.cph/out.txt", "w", stdout);
#else
std::cin.tie(0);
std::cout.tie(0);
std::ios::sync_with_stdio(false);
#endif
int t = 1;
std::cin >> t;
while(t--) {
solve();
}
}
/*
2
5
1 1 1
1 1 2
1 1 3
2 3 5
2 2 4
3
1 1 1
2 2 2
3 3 3
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3552kb
input:
2 5 1 1 1 1 1 2 1 1 3 2 3 5 2 2 4 3 1 1 1 2 2 2 3 3 3
output:
0 0 2 5 5 0 3 3
result:
ok 8 numbers
Test #2:
score: -100
Runtime Error
input:
16 1 1 1 1 2 1 1 1 1 1 100000 3 1 1 1 1 1 100000 1 100000 1 4 1 1 1 1 1 100000 1 100000 1 1 100000 100000 5 1 1 1 1 1 100000 1 100000 1 1 100000 100000 100000 1 1 6 1 1 1 1 1 100000 1 100000 1 1 100000 100000 100000 1 1 100000 1 100000 7 1 1 1 1 1 100000 1 100000 1 1 100000 100000 100000 1 1 100000 ...