Submission #417912

# Submission time Handle Problem Language Result Execution time Memory
417912 2021-06-04T13:56:36 Z rumen_m Pairs (IOI07_pairs) C++17
30 / 100
186 ms 6840 KB
# include <bits/stdc++.h>
using namespace std;
vector <vector <int> > a;
int b,n,d,m;
bool cmp1(vector <int> i, vector <int> j)
{
    return i[0]<j[0];
}
void solve_1()
{
    int i,j = 0;
    sort(a.begin(),a.end(),cmp1);
    long long ans = 0;
    for(i=0;i<n;i++)
    {
        while(a[j][0]+d<a[i][0])j++;
        ans+=(i-j);
    }
    cout<<ans<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);

cin>>b>>n>>d>>m;
int i,j;
a.resize(n);
for(i=0;i<n;i++)
{
    a[i].resize(b);
    for(j=0;j<b;j++)
        cin>>a[i][j];
}
if(b==1){solve_1();return 0;}
return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 128 ms 6164 KB Output is correct
2 Correct 134 ms 6168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 186 ms 6644 KB Output is correct
2 Correct 161 ms 6648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 165 ms 6648 KB Output is correct
2 Correct 166 ms 6668 KB Output is correct
3 Correct 148 ms 6576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 6324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 6476 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 6840 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 6396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 6524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 6612 KB Output isn't correct
2 Halted 0 ms 0 KB -