AtCoder Regular Contest 048

Submission #653699

Source codeソースコード

#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

Task問題 B - AtCoderでじゃんけんを
User nameユーザ名 舞葉
Created time投稿日時
Language言語 C++11 (GCC 4.9.2)
Status状態 TLE
Score得点 0
Source lengthソースコード長 1979 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt
All 0 / 100 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
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
06.txt TLE
07.txt TLE
08.txt TLE
09.txt TLE
10.txt TLE
11.txt AC 457 ms 11732 KB
12.txt AC 423 ms 11724 KB
13.txt AC 451 ms 11732 KB
14.txt TLE
15.txt TLE
16.txt TLE
17.txt TLE
18.txt TLE
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