# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
890840 | 2023-12-22T04:05:22 Z | Muhammad_Aneeq | Pairs (IOI07_pairs) | C++17 | 4000 ms | 27412 KB |
/* بسم الله الرحمن الرحيم Author: (:Muhammad Aneeq:) */ #include <iostream> #include <map> #include <set> #include <vector> using namespace std; int B1=75e6+10,B2=75e3+10,B3=75+10; int dis(vector<int>&a,vector<int>&b) { int z=0; for (int j=0;j<b.size();j++) z+=abs(a[j]-b[j]); return z; } inline void solve() { long long B,N,D,M; cin>>B>>N>>D>>M; int a[N][B]; map<vector<int>,int>d; for (int i=0;i<N;i++) { for (int j=0;j<B;j++) cin>>a[i][j]; } int ans=0; set<vector<int>>s; for (int i=0;i<N;i++) { vector<int>g; for (int j=0;j<B;j++) g.push_back(a[i][j]); d[g]++; s.insert(g); } vector<vector<int>>z={begin(s),end(s)}; for (int i=0;i<z.size();i++) { int g=d[z[i]]; ans+=(g*(g-1))/2; for (int j=i+1;j<z.size();j++) { int di=dis(z[i],z[j]); if (di<=D) ans+=d[z[i]]*d[z[j]]; } } cout<<ans<<endl; } int main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 604 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 860 KB | Output is correct |
2 | Incorrect | 69 ms | 1076 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4029 ms | 26448 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4034 ms | 26592 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 604 KB | Output is correct |
2 | Correct | 5 ms | 716 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 194 ms | 3668 KB | Output is correct |
2 | Execution timed out | 4051 ms | 4176 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4051 ms | 27036 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4091 ms | 27044 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 604 KB | Output is correct |
2 | Correct | 46 ms | 604 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 40 ms | 1804 KB | Output is correct |
2 | Incorrect | 67 ms | 2376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4059 ms | 22232 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4042 ms | 27412 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |