제출 #735507

#제출 시각아이디문제언어결과실행 시간메모리
735507CutebolPalembang Bridges (APIO15_bridge)C++17
0 / 100
5 ms452 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);} #define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> #define Ganyu ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0); #define int long long #define endl "\n" #define ff first #define ss second const int N = 2e5 + 5 ; const int inf = 1e9 ; const int mod = 1e9 + 7 ; int n , k , ans = inf ; int b[N] , d[N] ; char a[N] , c[N] ; int ch ( int x ){ int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += ( a[i] != c[i] ) ? abs(b[i]-x)+abs(d[i]-x)+1 : abs(b[i]-d[i]) ; return sum ; } void solve(){ cin >> k >> n ; set <int> t ; for ( int i = 0 ; i < n ; i ++ ) cin >> a[i] >> b[i] >> c[i] >> d[i] ; for ( int i = 0 ; i < n ; i ++ ) ans = min({ ch(b[i]) , ans , ch(d[i]) }) ; cout << ans ; } signed main(){ // fopn("") ; // Ganyu ; int t = 1 ; // cin >> t ; while ( t -- ) solve() ; }

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

bridge.cpp: In function 'void fopn(std::string)':
bridge.cpp:8:31: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 | void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bridge.cpp:8:72: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 | void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                                                                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...