제출 #48115

#제출 시각아이디문제언어결과실행 시간메모리
48115TheDarkningPalembang Bridges (APIO15_bridge)C++17
0 / 100
3 ms700 KiB
/** ▄█▀ ▀█▀ ▄▀▄ █▀ █▄█▄█ ▄▀▄ █▀ ▄█▀ <⇋⇋⇋⋛∰≓⊂(⌒,_ゝ⌒)⊃≓∰⋛⇋⇋⇋> ♔♕♖♗♘♙ ☜❷☞✪ ィℋ६ ≈ ᗫẵℜℵĬŊĞ ✪☜❷☞ ♚♛♜♝♞♟ ♔♕♖♗♘♙ ♚♛♜♝♞♟ ˙·٠•●♥ Ƹ̵̡Ӝ̵̨̄Ʒ ♥●•٠·˙ 1 5 B 0 A 4 B 1 B 3 A 5 B 7 B 2 A 6 B 1 A 7 **/ #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <iomanip> #include <time.h> #include <map> #include <deque> #include <assert.h> #include <queue> #include <string> #include <memory.h> #include <set> #include <math.h> #define sz(s) s.size() #define pb emplace_back #define fr first #define sc second #define mk make_pair #define int long long #define all(s) s.begin(), s.end() #define ok puts("ok"); using namespace std; const int N = 2e5 + 5; const int inf = 1e18 + 7; int n, k, ans, cnt, a[N], b[N]; char t1[N], t2[N]; vector < int > v; main(){ cin >> k >> n; for( int i = 1; i <= n; i++ ){ cin >> t1[i] >> a[i] >> t2[i] >> b[i]; if( t1[ i ] != t2[ i ] ){ cnt ++; } else{ cnt += abs( a[i] - b[i] );; } v.pb( a[i] ); v.pb( b[i] ); } sort( all( v ) ); int cur = v[ n ]; for( int i = 1; i <= n; i++ ){ if( t1[ i ] == t2[ i ] ){ continue; } ans += abs( cur - a[ i ] ) + abs( cur - b[ i ] ); } cout << ans + cnt; }

컴파일 시 표준 에러 (stderr) 메시지

bridge.cpp:50:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...