# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
298757 | 2020-09-14T00:41:47 Z | Hemimor | Pairs (IOI07_pairs) | C++14 | 3594 ms | 4740 KB |
#include <algorithm> #include <iostream> #include <iomanip> #include <numeric> #include <cassert> #include <vector> #include <cmath> #include <queue> #include <set> #include <map> #define syosu(x) fixed<<setprecision(x) using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int,int> P; typedef pair<double,double> pdd; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<string> vs; typedef vector<P> vp; typedef vector<vp> vvp; typedef vector<pll> vpll; typedef pair<P,int> pip; typedef vector<pip> vip; const int inf=1<<30; const ll INF=1ll<<60; const double pi=acos(-1); const double eps=1e-8; const ll mod=1e9+7; const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1}; const int M=76; int tp,n,d,mx; ll res=0; int main(){ scanf("%d%d%d%d",&tp,&n,&d,&mx); if(tp==1){ vi a(n); for(int i=0;i<n;i++) scanf("%d",&a[i]); sort(a.begin(),a.end()); int I=0; for(int i=0;i<n;i++){ while(a[i]-a[I]>d) I++; res+=i-I; } } if(tp==2){ assert(0); } if(tp==3){ int a[M][M][M],b[M][M][M]; for(int i=0;i<M;i++) for(int j=0;j<M;j++) for(int k=0;k<M;k++) a[i][j][k]=b[i][j][k]=0; for(int i=0;i<n;i++){ int x,y,z; cin>>x>>y>>z; a[x][y][z]++; b[x][y][z]++; } for(int i=0;i<M;i++) for(int j=0;j<M;j++) for(int k=1;k<M;k++) b[i][j][k]+=b[i][j][k-1]; for(int i=0;i<M;i++) for(int j=0;j<M;j++) for(int k=0;k<M;k++) if(a[i][j][k]){ ll tmp=-1; for(int I=0;I<M;I++) for(int J=0;J<M;J++){ int t=abs(I-i)+abs(J-j); if(t<=d){ tmp+=b[I][J][min(M-1,k+d-t)]-b[I][J][max(0,k-d+t-1)]; } } res+=tmp*a[i][j][k]; } res/=2; } printf("%lld\n",res); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 768 KB | Output is correct |
2 | Correct | 22 ms | 768 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 768 KB | Output is correct |
2 | Correct | 28 ms | 768 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 672 KB | Output is correct |
2 | Correct | 29 ms | 768 KB | Output is correct |
3 | Correct | 26 ms | 768 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 512 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 512 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 512 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 512 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 3840 KB | Output is correct |
2 | Correct | 42 ms | 3712 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 94 ms | 3712 KB | Output is correct |
2 | Correct | 91 ms | 4344 KB | Output is correct |
3 | Correct | 101 ms | 4344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 789 ms | 4216 KB | Output is correct |
2 | Correct | 2132 ms | 4728 KB | Output is correct |
3 | Correct | 2848 ms | 4728 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1423 ms | 4216 KB | Output is correct |
2 | Correct | 3301 ms | 4728 KB | Output is correct |
3 | Correct | 3594 ms | 4740 KB | Output is correct |