QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#77149 | #5499. Aliases | whymihere | Compile Error | / | / | C++23 | 8.1kb | 2023-02-13 05:37:18 | 2023-02-13 05:37:20 |
Judging History
This is the latest submission verdict.
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-02-13 05:37:20]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2023-02-13 05:37:18]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll bin_pow(ll a, ll b, ll m = 1e18){
ll ans = 1;
a = a%m;
while(b > 0){
if(b % 2 != 0)
ans = (ans*a) % m;
b = b >> 1;
a = (a*a)%m;
}
return ans;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll T;
cin >> T;
while(T--){
ll n, min_a = 6, min_b = 6;
cin >> n;
vector<pair<string,string>> s(n);
for(ll i = 0; i < n; i++){
string a, b;
cin >> a >> b;
while(a.length() > 6){
a.pop_back();
}
while(b.length() > 6){
b.pop_back();
}
min_a = min(min_a, (ll)a.length());
min_b = min(min_b, (ll)b.length());
s[i] = {a, b};
}
// cout << "min_a = " << min_a << ", min_b = " << min_b << '\n';
ll ans_a = 6, ans_b = 6, ans_c = 6;
for(ll i = 1; i <= 6; i++){
ll X = i, Y = 0;
// cout << "$(X, Y) = ";
// cout << X << " " << Y << "\n";
for(ll j = 0; j < i+1; j++){
if(X <= min_a && Y <= min_b){
// cout << "(X, Y) = ";
// cout << X << " " << Y << "\n";
unordered_map<string, ll> mp;
for(ll k = 0; k < n; k++){
string x = s[k].first, y = s[k].second;
while((ll)x.length() != X){
x.pop_back();
}
while((ll)y.length() != Y){
y.pop_back();
}
x += y;
mp[x]++;
}
ll mx = 1;
for(auto& var : mp){
mx = max(mx, var.second);
}
// for(ll k = 0; k <= 6; k++){
// if(bin_pow(10, k) >= mx){
// mx = k;
// break;
// }
// }
if(i + mx < ans_a + ans_b + ans_c){
ans_a = X;
ans_b = Y;
ans_c = (int)to_string(mx - 1).size();
}
}
X--;
Y++;
}
}
if(ans_a + ans_b + ans_c > 6) cout << "0 0 6";
else cout << ans_a << " " << ans_b << " " << ans_c;
cout << endl;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll bin_pow(ll a, ll b, ll m = 1e18){
ll ans = 1;
a = a%m;
while(b > 0){
if(b % 2 != 0)
ans = (ans*a) % m;
b = b >> 1;
a = (a*a)%m;
}
return ans;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll T;
cin >> T;
while(T--){
ll n, min_a = 6, min_b = 6;
cin >> n;
vector<pair<string,string>> s(n);
for(ll i = 0; i < n; i++){
string a, b;
cin >> a >> b;
while(a.length() > 6){
a.pop_back();
}
while(b.length() > 6){
b.pop_back();
}
min_a = min(min_a, (ll)a.length());
min_b = min(min_b, (ll)b.length());
s[i] = {a, b};
}
// cout << "min_a = " << min_a << ", min_b = " << min_b << '\n';
ll ans_a = 6, ans_b = 6, ans_c = 6;
for(ll i = 1; i <= 6; i++){
ll X = i, Y = 0;
// cout << "$(X, Y) = ";
// cout << X << " " << Y << "\n";
for(ll j = 0; j < i+1; j++){
if(X <= min_a && Y <= min_b){
// cout << "(X, Y) = ";
// cout << X << " " << Y << "\n";
unordered_map<string, ll> mp;
for(ll k = 0; k < n; k++){
string x = s[k].first, y = s[k].second;
while((ll)x.length() != X){
x.pop_back();
}
while((ll)y.length() != Y){
y.pop_back();
}
x += y;
mp[x]++;
}
ll mx = 1;
for(auto& var : mp){
mx = max(mx, var.second);
}
// for(ll k = 0; k <= 6; k++){
// if(bin_pow(10, k) >= mx){
// mx = k;
// break;
// }
// }
if(i + mx < ans_a + ans_b + ans_c){
ans_a = X;
ans_b = Y;
ans_c = (int)to_string(mx - 1).size();
}
}
X--;
Y++;
}
}
if(ans_a + ans_b + ans_c > 6) cout << "0 0 6";
else cout << ans_a << " " << ans_b << " " << ans_c;
cout << endl;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll bin_pow(ll a, ll b, ll m = 1e18){
ll ans = 1;
a = a%m;
while(b > 0){
if(b % 2 != 0)
ans = (ans*a) % m;
b = b >> 1;
a = (a*a)%m;
}
return ans;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll T;
cin >> T;
while(T--){
ll n, min_a = 6, min_b = 6;
cin >> n;
vector<pair<string,string>> s(n);
for(ll i = 0; i < n; i++){
string a, b;
cin >> a >> b;
while(a.length() > 6){
a.pop_back();
}
while(b.length() > 6){
b.pop_back();
}
min_a = min(min_a, (ll)a.length());
min_b = min(min_b, (ll)b.length());
s[i] = {a, b};
}
// cout << "min_a = " << min_a << ", min_b = " << min_b << '\n';
ll ans_a = 6, ans_b = 6, ans_c = 6;
for(ll i = 1; i <= 6; i++){
ll X = i, Y = 0;
// cout << "$(X, Y) = ";
// cout << X << " " << Y << "\n";
for(ll j = 0; j < i+1; j++){
if(X <= min_a && Y <= min_b){
// cout << "(X, Y) = ";
// cout << X << " " << Y << "\n";
unordered_map<string, ll> mp;
for(ll k = 0; k < n; k++){
string x = s[k].first, y = s[k].second;
while((ll)x.length() != X){
x.pop_back();
}
while((ll)y.length() != Y){
y.pop_back();
}
x += y;
mp[x]++;
}
ll mx = 1;
for(auto& var : mp){
mx = max(mx, var.second);
}
// for(ll k = 0; k <= 6; k++){
// if(bin_pow(10, k) >= mx){
// mx = k;
// break;
// }
// }
if(i + mx < ans_a + ans_b + ans_c){
ans_a = X;
ans_b = Y;
ans_c = (int)to_string(mx - 1).size();
}
}
X--;
Y++;
}
}
if(ans_a + ans_b + ans_c > 6) cout << "0 0 6";
else cout << ans_a << " " << ans_b << " " << ans_c;
cout << endl;
}
return 0;
}
Details
answer.code:107:4: error: redefinition of ‘ll bin_pow(ll, ll, ll)’ 107 | ll bin_pow(ll a, ll b, ll m = 1e18){ | ^~~~~~~ answer.code:5:4: note: ‘ll bin_pow(ll, ll, ll)’ previously defined here 5 | ll bin_pow(ll a, ll b, ll m = 1e18){ | ^~~~~~~ answer.code:120:5: error: redefinition of ‘int main()’ 120 | int main(){ | ^~~~ answer.code:18:5: note: ‘int main()’ previously defined here 18 | int main(){ | ^~~~ answer.code:209:4: error: redefinition of ‘ll bin_pow(ll, ll, ll)’ 209 | ll bin_pow(ll a, ll b, ll m = 1e18){ | ^~~~~~~ answer.code:5:4: note: ‘ll bin_pow(ll, ll, ll)’ previously defined here 5 | ll bin_pow(ll a, ll b, ll m = 1e18){ | ^~~~~~~ answer.code:222:5: error: redefinition of ‘int main()’ 222 | int main(){ | ^~~~ answer.code:18:5: note: ‘int main()’ previously defined here 18 | int main(){ | ^~~~