You are not logged in. Please login at www.codechef.com to post your questions!

×

TLE given codeforces question

The following code gives TLE but i think it should have given Runtime Errror... As The size of the input(n) was 10^5... and i took it as 100.

#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int x[102],y[102];
set<int> s1;
set<int> s2;
for(int i=1;i<=n;i++)
{
cin>>x[i]>>y[i];
s1.insert(x[i]);
s2.insert(y[i]);
}
cout<<min(s1.size(),s2.size())<<endl;
}

asked 12 Feb '14, 00:42

rajat1293's gravatar image

3★rajat1293
13
accept rate: 0%

edited 12 Feb '14, 03:41

sikander_nsit's gravatar image

5★sikander_nsit
1.5k82130

indent your code please!

(12 Feb '14, 00:48) v_akshay4★

s2.insert(x[i]); s1.insert(y[i]);

link

answered 12 Feb '14, 09:43

cosettelopez's gravatar image

0★cosettelopez
451
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×720

question asked: 12 Feb '14, 00:42

question was seen: 917 times

last updated: 12 Feb '14, 09:43