Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; const int INFint = 2147483647; const long long INF = 9223372036854775807ll; const long long MOD = 1000000007ll; int main() { ios_base::sync_with_stdio(0); long long n, k; cin >> n >> k; if (n * (n - 1) / 2 <= k) { cout << "no solution" << endl; return 0; }...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { long long int t, i, j, n, k, mx; mx = 1000000000LL; cin >> n >> k; t = (n * (n - 1)) / 2; if (t <= k) { cout << "no solution"; } else { for (i = 0; i < n - 1; i++) { cout << "0 " << i << "\n"; } cout << mx << " " << mx; } r...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { long n, k; cin >> n >> k; if (k >= n * (n - 1) / 2) { cout << "no solution"; return 0; } for (long i = 0; i < n; i++) cout << "0 " << i << endl; return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class C { BufferedReader reader; StringTokenizer tokenizer; PrintWriter out; public void solve() throws IOException { int N = nextInt(); int K = n...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> int main() { int n, k; scanf("%d%d", &n, &k); if (k >= n * (n - 1) / 2) { printf("no solution\n"); return 0; } for (int i = 0; i < n; ++i) printf("0 %d\n", i); }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; if (n * (n - 1) / 2 <= k) { cout << "no solution"; } else { for (int i = 0; i < n; i++) cout << "0 " << i << "\n"; } return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class ClosestPair { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); //READ---------------------------------------------------- int n = sc.nextIn...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
n, k = map(int, raw_input().split()) n -= 1 if k >= n * (n + 1) / 2: print "no solution" else: for i in range(n+1): print 0, i
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int n, k, p1, p2; int main() { cin >> n >> k; int tot = 0; for (int i = 1; i <= n; ++i) for (int j = i + 1; j <= n; ++j) ++tot; if (tot > k) { for (int i = 0; i < n; ++i) { cout << 0 << ' ' << i << endl; } } else cout << "no solution" << endl...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; if (k >= (n * (n - 1)) / 2) { cout << "no solution"; return 0; } for (int i = 0; i < n; i++) { cout << 0 << ' ' << i << endl; } return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
n,k = [int(x) for x in raw_input().split()] if k >= (n-1)*(n)/2: print("no solution") else: while n: print(1),n n -= 1
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.InputStreamReader; import java.io.PrintWriter; import static java.lang.Math.*; import java.util.ArrayList; import java.util.Scanner; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author pttrung */ public class C { public static long...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
[n,k]=[int(i) for i in raw_input().split()] if (n*(n-1)/2)<=k: print "no solution" else: x=0 y=0 j=0 for i in range(n): print 0,i ## print x,y ## j+=1 ## if j==n: ## break ## print x+1,y ## j+=1 ## if j==n: ## break ## pr...
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class B { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter out = ...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.math.BigInteger; import java.math.RoundingMode; public class a { public static int vertices=0; public static void main(String[] args) { Scanner s = new Scanner(System.in); int n=s....
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
//package Ladder_C; /** * Created by CompuShop on 7/25/2017 at 3:13 PM. */ import java.util.*; public class C_312 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(),k=in.nextInt(); if(k >= (n * (n - 1)) / 2) { System.o...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; char a[1000]; void solve() { int n, k; while (scanf("%d%d", &n, &k) != EOF) { if (((1 + n - 1) * (n - 1) / 2) <= k) { printf("no solution\n"); continue; } else { int temp = 0; for (int i = 1; i <= n; i++) { printf("0 %d\n", i); ...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
n, k = map(int, input().split()) if (k >= n * (n - 1) // 2): print("no solution") else: for i in range(n): print(0, i)
PYTHON3
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelp...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; string c; int main() { int i, j, k, n, m, l; scanf("%d%d", &n, &k); if (n * (n - 1) / 2 <= k) { puts("no solution"); return 0; } for (i = 1; i <= n; i++) printf("%d %d\n", 0, i); return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; struct node { int x; int y; }; node point[2000 + 10]; int n; int sum; void solve() { for (int i = 2; i <= n; ++i) { point[i].y = point[i - 1].y + 1; } for (int i = 1; i <= n; ++i) for (int j = i + 1; j <= n; ++j) ++sum; } int main() { int k; int tem; ...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 7; long long n, k; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> k; long long mx = n * (n - 1) / 2; if (k >= mx) return cout << "no solution", 0; long long y = 0; for (long long i = 1; i < n; i++, y += ...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.util.Scanner; public class r185d2c { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int k = scan.nextInt(); if((n*n-n)/2 <= k){ System.out.println("no solution"); } else { for(int i=0; i < n; i++){ System.out.println("0 " + ...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; inline long long inp() { long long n = 0, s = 1; char p = getchar(); if (p == '-') s = -1; while ((p < '0' || p > '9') && p != EOF && p != '-') p = getchar(); if (p == '-') s = -1, p = getchar(); while (p >= '0' && p <= '9') { n = (n << 3) + (n << 1) + (p - ...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class TheClosestPair implements Closeable { private InputReader in = new InputReader(System.in); ...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> int main() { int n, k; scanf("%d%d", &n, &k); if ((n * (n - 1) / 2) <= k) { printf("no solution\n"); } else { int i; for (i = 0; i < n; i++) { printf("0 %d\n", i); } } }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; template <class T> inline T Max(T a, T b) { if (a > b) return a; else return b; } template <class T> inline T Min(T a, T b) { if (a < b) return a; else return b; } template <class T> inline T gcd(T a, T b) { if (a < 0) return gcd(-a, b); if (b < ...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> int x[2010], y[2010]; using namespace std; int main() { int n, k; cin >> n >> k; for (int i = 0; i < n; ++i) x[i] = 0, y[i] = i; int c = 0, tot = 0; int d = (1 << 29); for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; ++j) { tot++; int t = (x[j] - x[i]) * (x[j...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
if __name__ == '__main__': n, k = [int(x) for x in raw_input().rstrip().split()] if n*(n-1) / 2 <= k: print 'no solution' else: for i in range(n): print '0 {}'.format(i)
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> int main() { int cn = 0, i, n, k, p; scanf("%d%d", &n, &k); if (k >= (n * (n - 1)) / 2) { printf("no solution\n"); return (0); } p = n; while (p--) { printf("0 %d\n", cn); cn++; } return (0); }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int n, k; int main() { cin >> n >> k; int temp = n * (n - 1) / 2; if (temp <= k) { cout << "no solution\n"; return 0; } for (int i = 0; i < n; i++) { cout << 0 << " " << i << endl; } return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; const int MAX = 2001; int N, K; int main() { scanf("%d%d", &N, &K); if (K >= N * (N - 1) / 2) { puts("no solution"); } else { for (int i = 0; i < N; i++) { printf("0 %d\n", i); } } return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import static java.util.Arrays.deepToString; import java.io.*; import java.math.*; import java.util.*; public class Main { static void solve() { int n = nextInt(); int k = nextInt(); int[] x = new int[n]; int[] y = new int[n]; if (n * (n - 1) <= 2 * k) { System...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; #pragma warning(disable : 4996) struct point { int x, y; }; int n, k; int dx[2010], dy[2010]; int tot; int sqr(int x) { return x * x; }; int imin(int a, int b) { if (a < b) return a; return b; }; void algo() { int d = 2100000000; for (int i = 0; i < n; i++) fo...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
n, k = map(int, input().split()) tot = 0 for i in range(n): for j in range(i + 1, n): tot += 1 if tot <= k: print('no solution') else: for i in range(n): print(1, i)
PYTHON3
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
n,k = map(int ,input().split()) if((n&1)==0) : time = (n//2)*(n-1) else : time = ((n-1)//2)*n if(k>=time): print("no solution") else : for i in range(n): print("0 "+str(i))
PYTHON3
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
/** * Created with IntelliJ IDEA. * User: Venky */ import java.io.*; import java.util.StringTokenizer; public class Main { static void solve() throws IOException { int n = nextInt(); int k = nextInt(); if( ((n-1)*n)/2 <= k) { out.println("no solution"); r...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, i, k; int tot; cin >> n >> k; tot = (n * (n - 1)) / 2; if (tot <= k) { cout << "no solution\n"; return 0; } for (i = 0; i < n; i++) { cout << i << " " << i * 100000 << "\n"; } return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; cin >> n >> k; long long tot; tot = (n * (n - 1)) / 2; if (tot <= k) { cout << "no solution"; return 0; } for (int i = 0; i < n; i++) cout << 0 << " " << i << endl; return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import sys import itertools def solve(n, k): comb = 0 for x in itertools.combinations([0]*n, 2): comb += 1 if comb<=k: return ["no solution"] res = [] #base = 2**n for i in xrange(n): #res.append(str(base/2**(i)) + " -" + str(base*2**(i))) res.append('0 -'+str(i+...
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int l = n * (n - 1); l /= 2; if (k >= l) { cout << "no solution\n"; return 0; } pair<int, int> p; vector<pair<int, int> > v; int a = 0, b = 0; for (int i = 0; i < n; i++) { p = make_pair(b, a); v.push...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String [] args ) { try{ String str; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedOutputStrea...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.util.Scanner; public class C185 { public void run() { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); if (n * (n - 1) <= 2 * k) { System.out.println("no solution"); System.exit(0); } int x[] = new int[n + 100]; int y[] = new int[n + 100]; x[0] = ...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.*; import java.util.*; public class C { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in; String FInput=""; void openInput(String file) { if(file==null)is = new BufferedReader(new InputStreamReader(System.in));//stdin else { t...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:256777216") using namespace std; int main() { int n, k; cin >> n >> k; if (2 * k >= n * (n - 1)) { puts("no solution"); return 0; } for (int i = 1; i <= n; i++) { cout << 0 << " " << i << endl; } return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.*; import java.util.*; import java.math.*; import static java.lang.Math.*; import static java.lang.Integer.*; // WA on 5 public class C185 { int INF = Integer.MAX_VALUE / 100; static Scanner sc = null; static BufferedReader br = null; static PrintStream out = null; static BufferedWriter bw = n...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.*; import java.util.*; public class SolutionC { BufferedReader in; StringTokenizer str; PrintWriter out; String SK; String next() throws IOException { while ((str == null) || (!str.hasMoreTokens())) { SK = in.readLine(); if (SK == null) return null; str =...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int cnt = (n * (n - 1)) / 2; if (cnt <= k) cout << "no solution"; else { for (int i = 1; i <= n; i++) { cout << 0 << ' ' << i << '\n'; } } }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
ar = raw_input().split(" ") n = int(ar[0]) k = int(ar[1]) tot = (n*(n-1))/2 if tot <= k: print "no solution" else: t = n a = 0 b = 0 while t: print a, b a = a+1 b = b+n t-=1
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class C312 { static StringTokenizer st; static BufferedReader in; static ...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int t, n, k, ax, bx, tot; cin >> n >> k; tot = (n * (n + 1)) / 2 - n; if (tot <= k) cout << "no solution" << endl; else { for (int i = 1; i <= n; i++) { cout << 0 << " " << i << endl; } } return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; unsigned long long mod = 1000000007; int main() { int nop, k; cin >> nop >> k; int max_possi = nop * (nop - 1); max_possi /= 2; if (k >= max_possi) cout << "no solution" << "\n"; else { int x = 0, y = 0; while (nop--) cout << x << " " << y++...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; long long distance(long long x1, long long y1, long long x2, long long y2) { return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)); } int main() { long long n, k, d, x, y, tot = 0; cin >> n >> k; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { t...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; if (n * (n - 1) <= 2 * k) cout << "no solution" << endl; else for (int y = 0; y < n; y++) { cout << 0 << " " << y << endl; } return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.util.*; import java.io.*; public class third { public static void main(String args[]) { int n,k; Scanner sc = new Scanner(System.in); n=sc.nextInt(); k=sc.nextInt(); if(k>=((n*(n-1))/2)) { System.out.println("no solution"); } else { int f=0,t=0; while(t<n) { System.out....
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.IOException; import java.io.InputStream; import java.util.InputMismatchException; public class CF { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); int N =sc.nextInt(); int K =sc.nextInt(); if(((N*(N-1))>>1)<=K){ System.out.println("no solution"); return...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; long n, k; int main() { ios_base::sync_with_stdio(0); cin >> n >> k; if (n * (n - 1) / 2 <= k) cout << "no solution" << endl; else for (int i = 0; i < n; i++) cout << 0 << " " << i << endl; cin.get(); cin.get(); return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int x = n - 1, tot = 0; tot = (x * (x + 1)) / 2; if (tot <= k) return cout << "no solution" << endl, 0; for (int i = 0; i < n; i++) cout << 1 << " " << i << endl; return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
n, k = map(int, raw_input().split()) if n*(n-1)/2 <= k: print "no solution" else: for i in range(0, n): print 0, i
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
f = lambda n: n*(n-1)/2 n,k = map(int, raw_input().split()) if k>=f(n): print 'no solution' else: for i in xrange(n): print 0,i
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.Scanner; public class Main implements Runnable { StreamTokenizer ST; PrintWriter out; BufferedReader br; Scanner in; public ...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.util.*; import java.io.*; public class C312 { class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream)); tokenizer = null; } public InputReader() throws FileNotF...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.math.*; import java.util.*; public class CF { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); if(((n * (n-1))/2) > k) { int m = 0; int j = 0; while(...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, tot; scanf("%d%d", &n, &tot); if (n * (n - 1) / 2 <= tot) { printf("no solution"); return 0; } for (int i = 0; i < n; i++) printf("%d %d\n", 0, i); return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.util.Scanner; public class ProblemC { public void solve() { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int k = scan.nextInt(); if ((n * (n - 1)) / 2 <= k) { System.out.println("no solution"); return; } for (...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.util.*; import java.io.*; import java.math.*; public class Main { static class Reader { private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} public int read() {if (nu...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
# -*- coding: utf-8 -*- n, k = (int(x) for x in raw_input().split()) m = (n - 1) * n / 2 if k >= m: print 'no solution' else: for i in range(n): print '{} {}'.format(0, i)
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#!/usr/bin/env python import sys n, k = map(int, sys.stdin.readline().strip().split()) mx = (n-1)*n / 2 if k >= mx: print 'no solution' else: for i in xrange(n): print 0, i
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.util.*; public class ClosestPair { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int k=s.nextInt(); point[] p=new point[n]; int c=0; for(int i=0;i<n;i++) { point pt = new point(); pt.x=0; pt.y=c; c++; ...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
n,k = map(int, raw_input().split()) if n*(n-1)/2 <= k: print "no solution" else: for i in range(n): print 0,i
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int tot = (n) * (n - 1); tot /= 2; if (tot <= k) cout << "no solution" << endl; else { for (int i = 0; i < n; ++i) cout << 1 << " " << i + 1 << endl; } }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; double distance(pair<int, int> a, pair<int, int> b) { return pow(a.first - b.first, 2.0) + pow(a.second - b.second, 2.0); } int gettot(vector<pair<int, int> > v) { sort(v.begin(), v.end()); double d = 1e100; int tot = 0; for (int i = 0; i < v.size(); i++) { fo...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.*; import java.util.*; public class main { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int sum = (n * (n-1)) / 2; if(sum <= k) { System.out.println("no solution"); } else { ...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
n,k=map(int,raw_input().split()) y=sum([x for x in range(1,n)]) if y>k: p=1 for i in range(n): print "0 "+str(p) p+=1 else: print "no solution"
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
n,k=map(int,input().split()) if n*(n-1)/2<=k: print("no solution") else: for i in range(0,n):print(0,i) # Made By Mostafa_Khaled
PYTHON3
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; if ((n * (n - 1)) / 2 <= k) { cout << "no solution\n"; } else { for (int i = 0; i < n; i++) { cout << "0 " << i << endl; } } return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
n,k = map(int, raw_input().split()) if k < n*(n-1)/2: for i in xrange(n): print 0, i else: print "no solution"
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int i, j, n; long long k; while (~scanf("%d%I64d", &n, &k)) { long long t = (long long)n * (n - 1) / 2; if (k >= t) { printf("no solution\n"); continue; } int y = 1; for (i = 0; i < n; i++) printf("%d %d\n", 0, y), y++; }...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writer; static int nextInt() throws IOException ...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 105; const int M = 505; const int MOD = int(1e9) + 7; const int INF = 0x3f3f3f3f; const double EPS = 1e-9; const double PI = acos(-1.0); const int dx[] = {-1, 1, 0, 0}; const int dy[] = {0, 0, -1, 1}; template <class T> inline T Min(T a, T b) { return a < b ...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
n,k = map(int,raw_input().split()) if n == 2 : print "no solution" exit() lim = n*(n-1)/2 if k>=lim: print "no solution" else: for _ in xrange(n): print "0 "+str(_)
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
n, k = map(int, raw_input().split()) if k >= (n * (n - 1)) / 2: print 'no solution' exit() for i in range(n): print 0, i
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; if (n * (n - 1) / 2 <= k) cout << "no solution"; else for (int i = 0; i < n; ++i) cout << "0 " << i << endl; return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> int main() { int n, k, i; scanf("%d %d", &n, &k); if (k < n * (n - 1) / 2) { for (i = 0; i < n; i++) printf("%d %d\n", 0, 3 * i); } else puts("no solution"); return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { // BufferedReader c = new BufferedReader(new InputStreamReader(System.in)); Scanner c=new Scanner(System.in); int n=c.nextInt(),k=c.nextInt(); int largestPossibleTime=(n*(n...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.util.*; import java.util.Map.Entry; import java.io.*; import java.awt.Point; import java.math.BigInteger; import static java.lang.Math.*; public class Codeforces_Solution_C implements Runnable{ final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; ...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import sys def main(): n, k = map(int, sys.stdin.readline().split()) if n * (n - 1) / 2 <= k: print "no solution" return for i in xrange(n): print 0, i return if __name__ == "__main__": main()
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.io.IOException; import java.util.Scanner; /** * Created with IntelliJ IDEA. * User: Alexander Shchegolev * Date: 26.05.13 * Time: 18:08 * To change this template use File | Settings | File Templates. */ public class Three { public static void main(String[] args) throws IOException { Scann...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; Outpu...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.util.*; import java.io.*; import java.math.*; public class C { public static Scanner scan = new Scanner(System.in); public static boolean bg = false; public static void main(String[] args) throws Exception { long n1 = Integer.parseInt(scan.next()); long n2 = Integer.parseInt(sc...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n; long long k; cin >> n >> k; int ans = (n * (n - 1)) / 2; if (k >= ans) { cout << "no solution" << endl; return 0; } else { for (int i = 0; i < n; i++) { cout << 0 << ' ' << i << endl; } } }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
n, k = map(int, input().split()) up = (int)(n * (n - 1) / 2); if k >= up: print ("no solution") else: for i in range (0, n): print (0, i)
PYTHON3
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int k, n; int main() { int i, j; scanf("%d%d", &n, &k); if (k >= (n * (n - 1) / 2)) puts("no solution"); else { for (i = 1; i <= n; ++i) printf("0 %d\n", i); } return 0; }
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; string mirror = "AHIMOTUVWXY"; string letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const int mxn = 1e6 + 5; const int mod = 1e9 + 7; int main() { long long n, m, i, j, k, x, y, t; cin >> n >> k; x = n * (n - 1) / 2; if (x <= k) { cout << "no solution" << endl; } els...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.*; import java.util.*; /** * * @author N-AssassiN */ public class Main { private static BufferedReader reader; private static BufferedWriter out; private static StringTokenizer tokenizer;...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.util.Scanner; public class Main2 { public static void main(String args[]){ Scanner input = new Scanner(System.in); int n = input.nextInt(); int k = input.nextInt(); sentence(n,k); } public static void sentence(int n,int k){ ...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
a,b=map(int,raw_input().split()) if b >= a*(a-1)/2: print 'no solution' else: cnt = 0 for i in range(0,a): print 0,i
PYTHON
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
import java.util.*; import java.util.concurrent.LinkedBlockingDeque; import java.util.zip.ZipEntry; import javax.imageio.stream.MemoryCacheImageInputStream; import javax.security.auth.Subject; import javax.security.auth.kerberos.KerberosKey; import javax.swing.plaf.basic.BasicScrollPaneUI.HSBChangeListener; import jav...
JAVA
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; const int maxn = 100500; const int infi = (1 << 30); const long long infl = (1LL << 62); const double eps = 1e-9; const long long mod = 1000000007LL; const double pi = acos(-1.0); int n, k; int main() { cin >> n >> k; if (n * (n - 1) <= k * 2) { cout << "no solution...
CPP
312_C. The Closest Pair
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded. The problem is the follows. Given n points in the plane, find a pair of points between...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k; scanf("%d %d", &n, &k); if ((n * (n - 1) / 2 <= k)) printf("no solution\n"); else { for (int i = 0; i < n; i++) printf("0 %d\n", i); } return 0; }
CPP