|
|
back to boardI believe this judge is absurd I tried binary search, harsh table, got TLE. then I thought using direct mapping table could get MLE, but never TLE, so i tried it, still TLE!!!tell me how could this code get TLE. #include <iostream> using namespace std; char a[1000000001]; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { int j; cin >> j; a[j] = 1; } int m; cin >> m; int cnt= 0; for (int i = 1; i <= m; ++i) { int j; cin >> j; cnt += a[j]; } cout << cnt; } Re: I believe this judge is absurd To start with, 1 billion might be a bit too huge of a number. Try 3 zeroes less maybe. Re: I believe this judge is absurd Re: I believe this judge is absurd Posted by Egor 21 Oct 2016 11:57 Insert this string: int main() { ios::sync_with_stdio(false); // It will speed up reading process } Re: I believe this judge is absurd It doesn't (significantly) speed up Visual C++, as for me. Using C-style IO (printf/scanf) is more predictable. |
|
|