@@ -66,23 +66,16 @@ cmd.handler = function(argv) {
66
66
if ( result . ok ) {
67
67
session . updateStat ( 'ac' , 1 ) ;
68
68
session . updateStat ( 'ac.set' , problem . fid ) ;
69
- core . getSubmission ( { id : result . id } , function ( e , submission ) {
70
- if ( e || ! submission || ! submission . distributionChart )
71
- return log . warn ( 'Failed to get submission beat ratio.' ) ;
72
-
73
- const lang = submission . distributionChart . lang ;
74
- const scores = submission . distributionChart . distribution ;
75
- const myRuntime = parseFloat ( result . runtime ) ;
76
-
77
- let ratio = 0.0 ;
78
- for ( let score of scores ) {
79
- if ( parseFloat ( score [ 0 ] ) >= myRuntime )
80
- ratio += parseFloat ( score [ 1 ] ) ;
81
- }
82
-
69
+ if ( result . runtime_percentile )
83
70
printLine ( result , 'Your runtime beats %d %% of %s submissions' ,
84
- ratio . toFixed ( 2 ) , lang ) ;
85
- } ) ;
71
+ result . runtime_percentile . toFixed ( 2 ) , result . lang ) ;
72
+ else
73
+ return log . warn ( 'Failed to get runtime percentile.' ) ;
74
+ if ( result . memory && result . memory_percentile )
75
+ printLine ( result , 'Your memory usage beats %d %% of %s submissions (%s)' ,
76
+ result . memory_percentile . toFixed ( 2 ) , result . lang , result . memory ) ;
77
+ else
78
+ return log . warn ( 'Failed to get memory percentile.' ) ;
86
79
} else {
87
80
printResult ( result , 'error' ) ;
88
81
printResult ( result , 'testcase' ) ;
0 commit comments