Dear All,

I had tried to solving the problem using C++.
However, I have no idea why Test Set 2 couldn't be passed by my source code.

Here is my code.

#include <bits/stdc++.h>

using namespace std;

set<char> group;
map<char, int> cnt;

vector<pair<int, char> > ans;

int main() {

ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

int T;
cin >> T;

for(int tc = 1; tc <= T; tc++) {
group.clear();
cnt.clear();
ans.clear();
int u; cin >> u;
for(int i = 0; i < 10000; i++) {
int n; cin >> n;
string s; cin >> s;
for(auto c : s) group.insert(c);
cnt[s[0]]++;
}

// assert(cnt.size()==9);
// assert(group.size()==10);
string answer(10, '?');

for(auto p : cnt) {
ans.emplace_back(p.second, p.first);
}

sort(ans.begin(), ans.end());

for(auto c : group) {
if(cnt.count(c) == 0) answer[0] = c;
}
for(int i = 0; i < 9; i++) {
answer[9-i] = ans[i].second;
}
cout << "Case #" << tc << ": " << answer << endl;
}

return 0;
}

My logic is to use Benford's law. I had found out the error point through 
debug.
I highlighted the lines.
Please, help me to figure out the reason...I spent 3 days to find the 
reason...

Thank you,
Lee Anne

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/adf2560f-eedb-40eb-861a-80df260af9bbn%40googlegroups.com.

Reply via email to