ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1196. History Exam

fireyyouth I believe this judge is absurd [4] // Problem 1196. History Exam 5 Oct 2016 20:53
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;
}
Oleg Baskakov Re: I believe this judge is absurd // Problem 1196. History Exam 6 Oct 2016 00:27
To start with, 1 billion might be a bit too huge of a number. Try 3 zeroes less maybe.
ToadMonster Re: I believe this judge is absurd [2] // Problem 1196. History Exam 6 Oct 2016 01:26
1) Try Visual C++ and c-style IO (printf/scanf)

2) http://acm.timus.ru/status.aspx?space=1&num=1196&author=184065 - run at 01:23:42
6 Oct 2016 - your program. MLE, as expected

Edited by author 06.10.2016 01:28
Egor Re: I believe this judge is absurd [1] // Problem 1196. History Exam 21 Oct 2016 11:57
Insert this string:

int main()
{
  ios::sync_with_stdio(false); // It will speed up reading process
}
ToadMonster Re: I believe this judge is absurd // Problem 1196. History Exam 21 Oct 2016 13:02
It doesn't (significantly) speed up Visual C++, as for me.
Using C-style IO (printf/scanf) is more predictable.