QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#227794 | #2937. CIDR | Thallium54# | WA | 0ms | 3808kb | C++20 | 1.0kb | 2023-10-27 23:23:55 | 2023-10-27 23:23:55 |
Judging History
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: ''