Submission #355609

# Submission time Handle Problem Language Result Execution time Memory
355609 2021-01-22T20:36:32 Z ogibogi2004 Pairs (IOI07_pairs) C++14
30 / 100
51 ms 2020 KB
#include<bits/stdc++.h>
using namespace std;
int b,n,d,m;
void solve1()
{
	vector<int>v;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin>>x;
		v.push_back(x);
	}
	sort(v.begin(),v.end());
	queue<int>q;
	long long ans=0;
	for(int i=0;i<v.size();i++)
	{
		q.push(v[i]);
		while(v[i]-q.front()>d)
		{
			q.pop();
		}
		ans+=q.size()-1;
	}
	cout<<ans<<endl;
}
int main()
{
	cin>>b>>n>>d>>m;
	if(b==1)solve1();
return 0;
}

Compilation message

pairs.cpp: In function 'void solve1()':
pairs.cpp:16:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for(int i=0;i<v.size();i++)
      |              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 1384 KB Output is correct
2 Correct 29 ms 1404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 1892 KB Output is correct
2 Correct 48 ms 2020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 1768 KB Output is correct
2 Correct 48 ms 1768 KB Output is correct
3 Correct 46 ms 1788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -