Submission #54610

# Submission time Handle Problem Language Result Execution time Memory
54610 2018-07-04T08:01:50 Z 김세빈(#1491) Pairs (IOI07_pairs) C++11
30 / 100
37 ms 1456 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll X[101010];
ll n, d, m;
ll ans;

void tc1()
{
	int i, j;
	
	for(i=0;i<n;i++){
		scanf("%lld", X+i);
	}
	
	sort(X, X+n);
	
	for(i=j=0;i<n;i++){
		for(;j<n && X[j] - X[i] <= d;j++);
		ans += j - i - 1;
	}
	
	printf("%lld\n", ans);
}

void tc2()
{
}

void tc3()
{
}

int main()
{
	ll dim;
	
	scanf("%lld%lld%lld%lld", &dim, &n, &d, &m);
	
	if(dim == 1) tc1();
	else if(dim == 2) tc2();
	else tc3();
	
	return 0;
}

Compilation message

pairs.cpp: In function 'void tc1()':
pairs.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", X+i);
   ~~~~~^~~~~~~~~~~~~
pairs.cpp: In function 'int main()':
pairs.cpp:41:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld%lld%lld", &dim, &n, &d, &m);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1256 KB Output is correct
2 Correct 37 ms 1384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 1384 KB Output is correct
2 Correct 27 ms 1384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1456 KB Output is correct
2 Correct 26 ms 1456 KB Output is correct
3 Correct 25 ms 1456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1456 KB Output isn't correct
2 Halted 0 ms 0 KB -