結果
問題 | No.449 ゆきこーだーの雨と雪 (4) |
ユーザー | 0w1 |
提出日時 | 2017-01-03 16:57:14 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,592 bytes |
コンパイル時間 | 2,501 ms |
コンパイル使用メモリ | 196,068 KB |
実行使用メモリ | 36,068 KB |
最終ジャッジ日時 | 2024-09-22 10:32:08 |
合計ジャッジ時間 | 12,544 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | AC | 376 ms
36,064 KB |
testcase_38 | AC | 314 ms
25,088 KB |
testcase_39 | AC | 249 ms
25,088 KB |
testcase_40 | AC | 249 ms
25,204 KB |
testcase_41 | AC | 277 ms
25,092 KB |
testcase_42 | AC | 277 ms
25,088 KB |
testcase_43 | AC | 169 ms
14,628 KB |
testcase_44 | AC | 128 ms
15,032 KB |
testcase_45 | AC | 204 ms
36,068 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector< int > vi; typedef vector< vi > vvi; typedef vector< ll > vl; typedef vector< vl > vvl; typedef pair< int, int > pii; typedef vector< pii > vp; typedef vector< double > vd; typedef vector< vd > vvd; typedef vector< string > vs; template< class T1, class T2 > int upmin( T1 &x, T2 v ){ if( x > v ){ x = v; return 1; } return 0; } template< class T1, class T2 > int upmax( T1 &x, T2 v ){ if( x < v ){ x = v; return 1; } return 0; } const int INF = 0x3f3f3f3f; int N; vi L; int T; vs name, P; void init(){ cin >> N; L = vi( N ); for( int i = 0; i < N; ++i ){ cin >> L[ i ]; } cin >> T; name = P = vs( T ); for( int i = 0; i < T; ++i ){ cin >> name[ i ] >> P[ i ]; } } map< int, int > mp; struct fenwick{ vi dat; fenwick( int sz ){ dat = vi( sz ); } void update( int x, int v ){ for( int i = x; i < dat.size(); i += i & -i ){ dat[ i ] += v; } } int sum( int x ){ int res = 0; for( int i = x; i > 0; i -= i & -i ){ res += dat[ i ]; } return res; } } *ftree; void preprocess(){ vi prob_solved_cnt( N ); map< string, int > user2score; vi score = { 0 }; for( int i = 0; i < T; ++i ){ if( P[ i ] == "?" ) continue; int p = P[ i ][ 0 ] - 'A'; int v = user2score[ name[ i ] ]; v += 50 * L[ p ] + 500 * L[ p ] / ( 8 + 2 * ++prob_solved_cnt[ p ] ); user2score[ name[ i ] ] = v; score.emplace_back( v ); } sort( score.begin(), score.end() ); score.erase( unique( score.begin(), score.end() ), score.end() ); for( int i = 0; i < score.size(); ++i ){ mp[ score[ i ] ] = i + 1; } ftree = new fenwick( score.size() + 1 ); // ftree->update( 0, name.size() ); } void solve(){ vi prob_solved_cnt( N ); map< string, int > user2score; map< string, int > user2rank_in_samescore; for( int i = 0; i < T; ++i ){ if( P[ i ] == "?" ){ cout << ftree->sum( ftree->dat.size() - 1 ) - ftree->sum( mp[ user2score[ name[ i ] ] ] ) + user2rank_in_samescore[ name[ i ] ] + 1 << endl; } else{ int p = P[ i ][ 0 ] - 'A'; int v = user2score[ name[ i ] ]; ftree->update( mp[ v ], -1 ); v += 50 * L[ p ] + 500 * L[ p ] / ( 8 + 2 * ++prob_solved_cnt[ p ] ); user2rank_in_samescore[ name[ i ] ] = ftree->sum( mp[ v ] ) - ftree->sum( mp[ v ] - 1 ); // 0 idx ftree->update( mp[ v ], 1 ); user2score[ name[ i ] ] = v; } } } signed main(){ ios::sync_with_stdio( 0 ); init(); preprocess(); solve(); return 0; }