QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#227796#2937. CIDRThallium54#WA 0ms3820kbC++201.0kb2023-10-27 23:26:212023-10-27 23:26:21

Judging History

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

  • [2023-10-27 23:26:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3820kb
  • [2023-10-27 23:26:21]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
 
typedef long long int ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
#define pii pair<int, int>

 
const int N = 2e5 + 100;
const int inf = 1e9;
const ll mod =  998244353;




int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        ll x = 0;
        int k;
        for (int j = 0; j < 4; j++) {
            char c;
            cin >> k;
            x = (x << 8) + k;
            if (j < 3) cin >> c;
        }
        a[i] = x;
    }
    for (int b = 31; b >= 0; b--) {
        int same = 1;
        for (int i = 0; i < n; i++) {
            if ((a[i] >> b & 1) != (a[0] >> b & 1)) {
                same = 0;
                break;
            }
        }
        if (!same) {
            if (b == 31) cout << 32 << endl;
            else cout << 31 - b << endl;
            return 0;
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3604kb

input:

4
10.0.0.1
10.0.0.24
10.0.0.8
10.0.0.16

output:

27

result:

ok single line: '27'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

5
10.0.0.1
10.0.0.24
10.0.0.8
10.1.0.1
10.0.0.16

output:

15

result:

ok single line: '15'

Test #3:

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

input:

2
127.0.0.1
127.0.0.53

output:

26

result:

ok single line: '26'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

3
0.0.0.128
0.0.0.3
0.0.128.5

output:

16

result:

ok single line: '16'

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3580kb

input:

5
123.123.123.123
123.123.123.123
123.123.123.123
123.123.123.123
123.123.123.123

output:


result:

wrong answer 1st lines differ - expected: '32', found: ''