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

I believe this judge is absurd
Posted by fireyyouth 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;
}
Re: I believe this judge is absurd
Posted by Oleg Baskakov 6 Oct 2016 00:27
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
Posted by ToadMonster 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
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
Posted by ToadMonster 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.