Submission #653699
Source Code Expand
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
using namespace std;
typedef unsigned char byte;
typedef long long int LLint;
typedef unsigned long long int uLLint;
int jk[4][4]={{0,0,0,0},{0,0,1,-1},{0,-1,0,1},{0,1,-1,0}};
bool cpvrh(vector<int>& v1,vector<int>& v2){
return v1[0]<v2[0];
}
int main(){
int i,j,k,n,a,b,w,l,d,jg;
vector<vector<int>> vrh;
vector<int> vh;
cin>>n;
for (i=0;i<n;i++){
cin>>a>>b;
vrh.push_back({a,b,i});
}
sort(vrh.begin(),vrh.end(),cpvrh);
vector<vector<int>> vres(n,vector<int>(3));
int itb=-1;
for (i=0;i<n;i++){
if(i<n-1&&vrh[i][0]==vrh[i+1][0]){
if (itb==-1) itb=i;
}else{
if (0<=itb){
for (j=itb;j<=i;j++){
vres[vrh[j][2]][0]+=itb;
vres[vrh[j][2]][1]+=n-i-1;
for (k=j+1;k<=i;k++){
switch (jk[vrh[j][1]][vrh[k][1]]){
case 0:
vres[vrh[j][2]][2]+=1;
vres[vrh[k][2]][2]+=1;
break;
case 1:
vres[vrh[j][2]][0]+=1;
vres[vrh[k][2]][1]+=1;
break;
case -1:
vres[vrh[j][2]][1]+=1;
vres[vrh[k][2]][0]+=1;
break;
}
}
}
itb=-1;
}else{
vres[vrh[i][2]][0]+=i;
vres[vrh[i][2]][1]+=n-i-1;
}
}
}
for (vector<int>& v:vres)
cout<<v[0]<<" "<<v[1]<<" "<<v[2]<<endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
B - AtCoderでじゃんけんを |
User |
m_buyoh |
Language |
C++11 (GCC 4.9.2) |
Score |
0 |
Code Size |
1979 Byte |
Status |
TLE |
Exec Time |
2038 ms |
Memory |
11864 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 100 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample_01.txt, sample_02.txt, sample_03.txt |
All |
01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt |
Case Name |
Status |
Exec Time |
Memory |
01.txt |
AC |
438 ms |
11732 KB |
02.txt |
AC |
496 ms |
11736 KB |
03.txt |
AC |
582 ms |
11740 KB |
04.txt |
AC |
514 ms |
11732 KB |
05.txt |
TLE |
2035 ms |
11856 KB |
06.txt |
TLE |
2035 ms |
11852 KB |
07.txt |
TLE |
2035 ms |
11852 KB |
08.txt |
TLE |
2036 ms |
11848 KB |
09.txt |
TLE |
2036 ms |
11856 KB |
10.txt |
TLE |
2035 ms |
11864 KB |
11.txt |
AC |
457 ms |
11732 KB |
12.txt |
AC |
423 ms |
11724 KB |
13.txt |
AC |
451 ms |
11732 KB |
14.txt |
TLE |
2035 ms |
11864 KB |
15.txt |
TLE |
2037 ms |
11852 KB |
16.txt |
TLE |
2038 ms |
11848 KB |
17.txt |
TLE |
2034 ms |
11856 KB |
18.txt |
TLE |
2033 ms |
11852 KB |
19.txt |
AC |
486 ms |
11656 KB |
20.txt |
AC |
467 ms |
11728 KB |
21.txt |
AC |
436 ms |
11728 KB |
22.txt |
AC |
454 ms |
11676 KB |
23.txt |
AC |
438 ms |
11732 KB |
24.txt |
AC |
436 ms |
11736 KB |
25.txt |
AC |
24 ms |
804 KB |
26.txt |
AC |
25 ms |
732 KB |
27.txt |
AC |
25 ms |
924 KB |
28.txt |
AC |
26 ms |
800 KB |
sample_01.txt |
AC |
26 ms |
916 KB |
sample_02.txt |
AC |
26 ms |
732 KB |
sample_03.txt |
AC |
25 ms |
920 KB |