QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#537634 | #7882. Linguistics Puzzle | BrotherCall | WA | 4ms | 3696kb | C++20 | 2.0kb | 2024-08-30 17:02:55 | 2024-08-30 17:02:55 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 300;
int t , n;
string guai = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int GS[N] , QD[N] , JB[N];
int gs[N] , qd[N] , jb[N];
int xl[N];
int cz[N];
string s;
string sss;
void cs(int x,int n) {
if(x / n != 0) cs(x / n , n);
sss += guai[x % n];
}
bool compare(int s1,int s2) {
return gs[s1] > gs[s2];
}
void solve() {
cin >> n;
for(int i = 0;i <= 200;i ++)
gs[i] = 0 , qd[i] = 0 , cz[i] = 0 , GS[i] = QD[i] = 0 , jb[i] = JB[i] = 0;
for(int i = 0;i <= n - 1;i ++)
for(int j = 0;j <= n - 1;j ++) {
sss = "";
cs(i * j , n);
if(sss.size() == 2) GS[sss[0]] ++ , JB[sss[1]] ++;
if(sss.size() == 1) QD[sss[0]] ++;
}
for(int i = 1;i <= n * n;i ++) {
cin >> s;
if(s.size() == 2) gs[s[0]] ++ , jb[s[1]] ++;
if(s.size() == 1) qd[s[0]] ++;
}
for(int i = 0;i <= n - 1;i ++) {
for(int j = 0;j <= n - 1;j ++) {
if(gs[guai[j]] == GS[guai[i]] && qd[guai[j]] == QD[guai[i]] && jb[guai[j]] == JB[guai[i]]) {
cout << guai[j];
}
}
}
cout << "\n";
// for(int i = 0;i <= 200;i ++)
// if(qd[i] == 2 * n - 1) {cout << char(i); cz[i] = 1;}
// for(int i = 0;i <= 200;i ++)
// if(qd[i] == 1) { cout << char(i); cz[i] = 1;}
// int cnt = 0;
// if(n <= 26) {
// for(int i = 'a';i <= 'a' + n - 1;i ++)
// if(!cz[i]) xl[++cnt] = i;
// } else {
// for(int i = 'a';i <= 'z';i ++)
// if(!cz[i]) xl[++cnt] = i;
// for(int i = 'A';i <= 'A' + n - 27;i ++)
// if(!cz[i]) xl[++cnt] = i;
// }
// sort(xl + 1 , xl + 1 + cnt , compare);
// for(int i = 1;i <= cnt;i ++)
// cout << char(xl[i]);
// cout << "\n";
}
int main() {
// freopen("fuck.txt","r",stdin);
cin >> t;
while(t --) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3632kb
input:
2 3 a b a b b b b c cc 4 d d d d d c b a d b cd cb d a cb bc
output:
bca dcba
result:
ok OK
Test #2:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
2 4 d a a bc ba bc b a a a d a a cb c c 4 a b da b b d ad b db b a c da b c b
output:
abcd bdac
result:
ok OK
Test #3:
score: -100
Wrong Answer
time: 4ms
memory: 3632kb
input:
50 3 b b b a a c b b cc 4 d ab c ad d b ba ab c b d d d d d a 5 a aa aa ab ab ae b b e c c c ba c c c c dd d d dd c e c e 6 a ca a a a a a a ce a a b ba ba bc bc bd be e c c ca a cd cd be d d dc dc e e a eb f f 7 a a a a a a a a cf a a a a b b b b c c c cf a dd d dc d dd e f ed ee ee fb eg eg eg eg ...
output:
bca dabc cadbe abcdef aefdcgb fcheabgd bhgfedcia jhcgfideba fjbadkegcih klhgjbaedcif igkjmclfedhba nflijahgmbdcek anmlfijbgkhdceo nofmlkjchdbegipa aponblgjihcfqdkme iqmonhckfrpgjedlba prisodmbkjqghfencla tcrdpoaklmjihfgeqsbn utiraponmlksghjfecdbq qotsrvjunmlkpiegfhdcba pvutsrhwoimlkjnqgfedbca xbvuts...
result:
wrong answer invalid length at case #28