QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#755846#9557. Temperanceucup-team5351#TL 190ms10004kbC++202.4kb2024-11-16 18:12:022024-11-16 18:12:03

Judging History

你现在查看的是最新测评结果

  • [2024-11-16 18:12:03]
  • 评测
  • 测评结果:TL
  • 用时:190ms
  • 内存:10004kb
  • [2024-11-16 18:12:02]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#define ALL(v) v.begin(),v.end()
#define For(i,_) for(int i=0,i##end=_;i<i##end;++i) // [0,_)
#define FOR(i,_,__) for(int i=_,i##end=__;i<i##end;++i) // [_,__)
#define Rep(i,_) for(int i=(_)-1;i>=0;--i) // [0,_)
#define REP(i,_,__) for(int i=(__)-1,i##end=_;i>=i##end;--i) // [_,__)
typedef long long ll;
typedef unsigned long long ull;
#define V vector
#define pb push_back
#define pf push_front
#define qb pop_back
#define qf pop_front
#define eb emplace_back
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
#define fi first
#define se second
const int dir[4][2]={{-1,0},{0,1},{1,0},{0,-1}},inf=0x3f3f3f3f,mod=1e9+7;
const ll infl=0x3f3f3f3f3f3f3f3fll;
template<class T>inline bool ckmin(T &x,const T &y){return x>y?x=y,1:0;}
template<class T>inline bool ckmax(T &x,const T &y){return x<y?x=y,1:0;}
int init=[](){return cin.tie(nullptr)->sync_with_stdio(false),0;}();
template<class T>
struct disc{
	// 0-indexed
	vector<T>d;
	inline disc(){}
	inline void insert(const T &x){d.pb(x);}
	inline void insert(const V<T> &v){d.insert(d.end(),ALL(v));}
	inline void init(){sort(ALL(d));d.erase(unique(ALL(d)),d.end());}
	inline disc(const vector<T> &v){d=move(v);init();}
	inline int query(const T &x){return lower_bound(ALL(d),x)-d.begin();}
	inline int size(){return d.size();}
};
int main(){
    int t_case=1;
    scanf("%d",&t_case);
    while(t_case--){
        int n;
        scanf("%d",&n);
        V<int>x(n),y(n),z(n);
        For(i,n)scanf("%d%d%d",&x[i],&y[i],&z[i]);
        disc<int>dx(x),dy(y),dz(z);
        V<int>X(dx.size()),Y(dy.size()),Z(dz.size());
        For(i,n)++X[x[i]=dx.query(x[i])],++Y[y[i]=dy.query(y[i])],++Z[z[i]=dz.query(z[i])];
        int ans=0;
        list<int>l;
        For(i,n)l.pb(i);
        For(i,n){
            while(1){
                bool flag=false;
                for(auto it=l.begin();it!=l.end();){
                    if(max({X[x[*it]],Y[y[*it]],Z[z[*it]]})<=i){
                        ++ans;
                        flag=true;
                        --X[x[*it]],--Y[y[*it]],--Z[z[*it]];
                        it=l.erase(it);
                    }
                    else ++it;
                }
                if(!flag)break;
            }
            printf("%d%c",ans," \n"[i+1==n]);
        }
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3768kb

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: 0
Accepted
time: 0ms
memory: 3888kb

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 ...

output:

0
0 0
0 0 0
0 0 0 0
0 0 0 1 5
0 0 0 0 6 6
0 0 0 0 7 7 7
0 0 0 0 8 8 8 8
0
0 0
0 0 0
0 0 0 0
0 0 0 1 5
0 0 0 0 6 6
0 0 0 0 7 7 7
0 0 0 0 8 8 8 8

result:

ok 72 numbers

Test #3:

score: 0
Accepted
time: 59ms
memory: 3896kb

input:

10000
22
1 4 4
7 2 6
6 5 4
4 4 1
1 7 1
7 6 6
5 8 6
4 4 8
6 7 6
1 7 3
5 7 8
5 1 3
2 1 7
1 2 5
6 1 2
3 1 1
7 3 8
1 4 6
6 5 7
4 4 7
7 7 5
3 4 6
13
2 7 3
2 7 5
5 1 5
8 7 1
6 6 7
3 5 8
8 1 6
4 8 4
1 4 3
6 2 5
6 8 4
1 5 5
5 3 4
28
4 7 2
3 8 5
1 1 6
1 7 4
5 5 6
6 1 5
4 5 2
1 1 5
2 6 3
4 3 6
4 5 7
3 3 6
6 8...

output:

0 0 0 0 7 12 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22
0 0 3 9 13 13 13 13 13 13 13 13 13
0 0 0 0 8 21 21 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28
0 0 1 9 9 14 14 14 14 14 14 14 14 14
0 0 0 6 9 12 12 19 19 19 19 19 19 19 19 19 19 19 19
0 0 0 0 3 8 10 22 36 36 36 36 36 36 ...

result:

ok 199157 numbers

Test #4:

score: 0
Accepted
time: 72ms
memory: 3828kb

input:

10000
11
16 4 3
13 14 10
6 2 19
4 16 7
13 11 13
18 6 20
19 11 5
17 4 19
2 2 17
8 18 5
14 14 1
39
3 12 9
4 9 17
5 7 2
4 12 15
5 12 14
15 20 16
19 11 12
5 8 13
13 18 12
9 14 15
12 18 13
19 11 18
14 17 14
2 19 4
9 3 10
19 5 2
19 10 12
6 10 6
20 16 18
5 20 6
5 8 5
17 14 19
10 5 5
13 9 9
2 5 16
20 14 14
...

output:

0 2 11 11 11 11 11 11 11 11 11
0 0 2 11 22 33 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
0
0 3 12 15 15 15 15 15 15 15 15 15 15 15 15
0 1 3 21 25 32 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38...

result:

ok 199593 numbers

Test #5:

score: 0
Accepted
time: 64ms
memory: 3824kb

input:

10000
22
40126 51309 54005
77536 83774 68530
35537 89229 39298
26549 72686 40526
72054 78714 67371
54406 93387 54598
62891 79741 7031
21699 38166 16961
98001 73695 16118
23105 44313 87949
61147 44816 82830
40866 30839 37096
63254 98489 15491
2724 410 12208
96504 21764 35334
777 98615 64141
98638 282...

output:

0 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22
0 10 10 10 10 10 10 10 10 10
0 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29
0 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22
0 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26...

result:

ok 194828 numbers

Test #6:

score: 0
Accepted
time: 67ms
memory: 3820kb

input:

20000
13
2 7 2
11 1 15
7 11 11
14 3 2
8 4 2
14 13 3
1 3 9
1 9 6
10 5 9
3 6 14
11 3 2
10 10 2
4 14 8
18
7 1 7
15 6 14
10 4 2
9 11 6
12 3 2
6 12 4
14 14 8
15 6 4
9 12 1
14 4 6
3 5 13
15 1 5
5 7 3
14 7 14
6 13 5
15 15 5
3 13 5
5 4 13
17
12 12 9
10 12 9
6 11 4
15 1 14
6 3 15
6 6 10
6 8 3
15 5 9
12 6 7
1...

output:

0 3 7 8 8 13 13 13 13 13 13 13 13
0 0 7 12 18 18 18 18 18 18 18 18 18 18 18 18 18 18
0 0 5 6 17 17 17 17 17 17 17 17 17 17 17 17 17
0 0 3
0 1 5 5 5
0 2 8 15 15 15 15 15 15 15 15 15 15 15 15
0 1 6 9 9 9 9 9 9
0 0 5 17 17 17 17 17 17 17 17 17 17 17 17 17 17
0 1 5 5 5
0 2
0
0 0 13 16 16 16 16 16 16 16 ...

result:

ok 191387 numbers

Test #7:

score: 0
Accepted
time: 59ms
memory: 3904kb

input:

20000
2
69026 89423 26470
19943 3587 25231
9
96641 23438 60068
67211 19770 48041
15125 93974 46480
5771 64091 75193
17303 53889 28772
24105 87959 20685
14225 35987 93612
79842 79992 89652
81542 34986 15554
15
7463 88448 20014
74043 61063 90326
80812 97411 13843
38384 61124 37764
18186 80264 55309
12...

output:

0 2
0 9 9 9 9 9 9 9 9
0 15 15 15 15 15 15 15 15 15 15 15 15 15 15
0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
0 7 7 7 7 7 7
0 8 8 8 8 8 8 8
0 13 13 13 13 13 13 13 13 13 13 13 13
0 4 4 4
0 3 3
0 3 3
0 5 5 5 5
0 2
0 2
0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
0 3 3
0 13 13 13 13 13 13 13 13 13...

result:

ok 189019 numbers

Test #8:

score: 0
Accepted
time: 190ms
memory: 6540kb

input:

2
61322
15 48 50
13 48 35
41 1 39
4 4 46
13 46 39
48 43 8
37 28 42
47 6 18
15 27 25
11 34 45
33 28 9
33 37 15
40 16 26
13 10 22
10 41 17
21 22 8
37 31 48
11 48 29
1 45 49
26 28 3
35 20 36
17 42 40
42 45 36
49 32 28
46 37 5
35 50 49
30 36 32
17 35 11
38 49 27
25 7 21
41 7 3
25 48 9
4 17 13
12 30 23
3...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 64422 numbers

Test #9:

score: 0
Accepted
time: 95ms
memory: 8472kb

input:

2
82319
81784 15676 55428
36920 13434 44904
46877 92320 35269
44212 4490 14286
46939 25409 46324
66302 38351 14822
2554 1983 16106
23690 16816 73141
23210 66029 15099
93719 34782 576
22743 40722 70251
59272 25745 16644
50442 3167 5358
42914 48423 52435
546 35826 2467
42278 59162 52914
56020 16044 76...

output:

0 6924 42079 70072 79822 81906 82247 82310 82310 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319...

result:

ok 130773 numbers

Test #10:

score: 0
Accepted
time: 144ms
memory: 10004kb

input:

2
100000
95821 95821 95821
54965 54965 54965
63811 63811 63811
11219 11219 11219
27274 27274 27274
76752 76752 76752
70949 70949 70949
59746 59746 59746
84495 84495 84495
60363 60363 60363
93707 93707 93707
91384 91384 91384
81227 81227 81227
13202 13202 13202
80413 80413 80413
67024 67024 67024
955...

output:

0 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 1000...

result:

ok 200000 numbers

Test #11:

score: -100
Time Limit Exceeded

input:

2
100000
95821 100000 100000
54965 100000 100000
63811 100000 100000
11219 100000 100000
27274 100000 100000
76752 100000 100000
70949 100000 100000
59746 100000 100000
84495 100000 100000
60363 100000 100000
93707 100000 100000
91384 100000 100000
81227 100000 100000
13202 100000 100000
80413 10000...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result: