QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#156318#7112. XOR Cliqueucup-team520#WA 76ms4704kbC++233.3kb2023-09-02 13:25:472023-09-02 14:48:28

Judging History

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

  • [2023-09-02 14:48:28]
  • 评测
  • 测评结果:WA
  • 用时:76ms
  • 内存:4704kb
  • [2023-09-02 13:25:47]
  • 提交

answer

#include <bits/stdc++.h>   
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;   
using namespace std;  
#define ll int
#define pb push_back                   
#define mp make_pair          
#define nline "\n"                             
#define f first                                            
#define s second                                             
#define pll pair<ll,ll>   
#define all(x) x.begin(),x.end()       
#define vl vector<ll>             
#define vvl vector<vector<ll>>          
#define vvvl vector<vector<vector<ll>>>          
#ifndef ONLINE_JUDGE    
#define debug(x) cerr<<#x<<" "; _print(x); cerr<<nline;  
#else
#define debug(x);      
#endif  
void _print(ll x){cerr<<x;}
void _print(char x){cerr<<x;}     
void _print(string x){cerr<<x;}    
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   
template<class T,class V> void _print(pair<T,V> p) {cerr<<"{"; _print(p.first);cerr<<","; _print(p.second);cerr<<"}";}
template<class T>void _print(vector<T> v) {cerr<<" [ "; for (T i:v){_print(i);cerr<<" ";}cerr<<"]";}
template<class T>void _print(set<T> v) {cerr<<" [ "; for (T i:v){_print(i); cerr<<" ";}cerr<<"]";}
template<class T>void _print(multiset<T> v) {cerr<< " [ "; for (T i:v){_print(i);cerr<<" ";}cerr<<"]";}
template<class T,class V>void _print(map<T, V> v) {cerr<<" [ "; for(auto i:v) {_print(i);cerr<<" ";} cerr<<"]";} 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_pset;
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
const ll MOD=998244353;
const ll MAX=500500;
const ll till=20;
vector<unordered_map<ll,ll>> freq(till);
void solve(){         
    ll n; cin>>n;
    for(ll i=0;i<till;i++){
        freq[i].clear();
    }
    vector<ll> a(n);
    for(auto &it:a){
        cin>>it;
    }
    sort(all(a));  
    reverse(all(a));
    ll ans=0;
    vector<ll> nax(till,0);
    for(auto it:a){
        ll num=0;
        for(ll i=30;i>=0;i--){
            if(it&(1<<i)){
                num+=(1<<i);
            }
            if(i<till){
                nax[i]=max(nax[i],++freq[i][num]);
            }
        }
        for(ll j=0;j<till;j++){
            if((1<<j)<=it){
                ans=max(ans,nax[j]); 
            }
        }
    }
    cout<<ans<<nline;
    return;        
}                                                                     
int main()                                                                                                             
{                
    ios_base::sync_with_stdio(false);                                  
    cin.tie(NULL);                                              
    ll test_cases=1;               
    cin>>test_cases;
    while(test_cases--){
        solve();
    } 
    cout<<fixed<<setprecision(10);
    cerr<<"Time:"<<1000*((double long)clock())/(double long)CLOCKS_PER_SEC<<"ms\n"; 
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
3
1 2 3
3
1 1 1
5
1 2323 534 534 5

output:

2
3
2

result:

ok 3 number(s): "2 3 2"

Test #2:

score: 0
Accepted
time: 21ms
memory: 3984kb

input:

10000
10
10 8 8 8 8 2 5 4 8 7
10
8 9 3 2 7 10 3 10 3 10
10
2 10 10 4 10 10 10 1 5 10
10
4 4 1 4 10 3 4 6 4 6
10
7 3 4 5 9 4 4 7 8 8
10
8 6 5 1 6 2 7 3 7 4
10
2 8 7 3 10 5 1 6 8 3
10
6 4 7 4 10 4 8 5 7 6
10
8 5 5 3 8 1 9 10 8 9
10
10 8 10 8 3 6 10 8 2 6
10
10 7 4 10 1 8 4 6 2 3
10
9 10 4 2 7 5 5 4 4 ...

output:

6
5
6
7
6
6
3
8
6
6
4
7
6
3
4
4
4
5
3
6
4
5
4
5
5
4
3
6
6
6
4
8
5
4
5
5
6
6
4
4
4
5
4
5
5
3
5
7
5
5
4
4
5
6
6
5
7
4
4
4
4
5
4
3
6
4
4
3
4
6
3
6
4
4
4
5
5
5
4
4
6
5
4
7
4
5
4
4
4
5
4
4
4
6
5
5
5
5
5
4
7
5
4
6
5
4
4
4
4
5
4
5
6
8
4
5
4
5
9
5
4
3
4
5
5
4
5
4
4
3
5
5
4
5
5
4
5
4
5
5
4
4
3
3
4
4
5
4
8
5
...

result:

ok 10000 numbers

Test #3:

score: 0
Accepted
time: 22ms
memory: 3992kb

input:

1000
100
31 41 94 23 98 34 23 99 68 31 98 43 28 90 19 43 97 36 35 11 63 47 70 57 46 29 74 99 83 83 42 28 66 58 24 18 93 54 3 46 39 86 98 84 58 85 75 46 50 64 5 58 67 29 18 5 63 94 74 85 70 12 6 4 44 9 90 58 23 46 39 79 70 97 97 18 75 84 51 43 77 73 98 54 47 52 86 94 76 16 45 75 44 14 81 53 49 12 58 ...

output:

40
36
38
35
39
36
38
42
38
40
40
37
36
43
42
37
44
35
45
38
42
33
39
42
36
36
46
37
32
46
44
34
41
33
35
37
39
37
32
40
37
43
40
33
45
36
41
31
39
40
36
35
35
39
31
52
36
36
41
35
38
41
34
35
38
37
36
38
35
37
39
40
40
40
34
35
44
43
35
40
34
41
36
32
38
37
38
36
40
37
37
36
35
34
38
37
45
38
39
38
...

result:

ok 1000 numbers

Test #4:

score: 0
Accepted
time: 23ms
memory: 3924kb

input:

100
1000
903 492 790 186 953 974 661 801 790 194 464 866 442 969 548 824 611 799 83 872 85 667 353 172 526 947 368 291 474 446 437 111 808 16 329 845 714 577 904 873 65 638 181 471 600 831 996 435 572 95 695 826 74 160 778 423 89 420 967 719 331 949 347 613 793 197 135 951 876 719 952 62 309 893 551...

output:

509
488
475
510
534
486
487
486
511
498
478
490
451
493
497
493
487
498
483
503
483
507
509
491
485
461
479
478
493
503
514
477
493
499
500
481
500
469
482
472
479
488
474
503
488
500
481
509
491
479
496
522
495
502
484
515
486
484
469
497
499
486
512
491
508
474
495
487
493
512
468
491
490
482
480
...

result:

ok 100 numbers

Test #5:

score: 0
Accepted
time: 31ms
memory: 4704kb

input:

10
10000
5285 2073 7309 54 2183 1460 5877 9121 9200 3992 1728 5442 1118 4300 8567 9658 9618 9531 1652 286 9506 3396 8311 2198 263 7561 2148 447 9632 3936 2723 6938 9566 5333 8399 8763 3126 7110 8088 7514 4306 149 2385 4853 4064 90 2626 7324 8465 4959 2199 7396 2123 5634 607 8165 936 7766 5326 7404 2...

output:

4150
4007
4027
4128
4119
4109
4207
3964
4147
4052

result:

ok 10 numbers

Test #6:

score: -100
Wrong Answer
time: 76ms
memory: 3984kb

input:

10000
10
280451563 345810854 770436752 598622543 887124330 25405486 761170404 304973882 88233746 926776090
10
501279697 561221354 616450860 372349246 194446593 700711526 166921955 468736755 182963522 647567226
10
264111817 899530903 149825543 471443764 375924049 397433611 226749669 978130792 2267380...

output:

1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 1st numbers differ - expected: '5', found: '1'