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 1086. Cryptography

Mushfiq Talha RTE in Test #1. [2] // Problem 1086. Cryptography 14 Aug 2019 19:26
#include <iostream>

using namespace std;

int prime[15001];
bool num[163848];
void sieve() {
    num[2]=true;
    prime[1]=2;
    long int i,j,k;
    for(i=3;i<163848;i+=2) num[i]=1;
    for(i=2,j=3;i<=15000;j+=2) {
        if(num[j]) {
            for(k=j;k*j<=163848;k+=2) num[k*j]=0;
            prime[i]=j;
            i++;
        }
    }
}

int main() {
    sieve();
    int t;
    cin>>t;
    while(t--) {
        int m;
        cin>>m;
        cout<<prime[m]<<endl;
    }
}


Why am I getting RTE in test #1?

Edited by author 13.09.2019 08:33
Mushfiq Talha Re: RTE in Test #1. [1] // Problem 1086. Cryptography 17 Aug 2019 19:10


Edited by author 18.08.2019 21:37
Mushfiq Talha What is the size of int in Timus? // Problem 1086. Cryptography 2 Nov 2019 07:50
What is the size of int in this oj? 2 or 4 Bytes?