QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#227794#2937. CIDRThallium54#WA 0ms3808kbC++201.0kb2023-10-27 23:23:552023-10-27 23:23:55

Judging History

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

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

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<int> 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;
}


详细

Test #1:

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

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: 3552kb

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: 3808kb

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: 3736kb

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: 3544kb

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: ''