제출 #1146409

#제출 시각아이디문제언어결과실행 시간메모리
1146409KluydQWeighting stones (IZhO11_stones)C++17
0 / 100
1 ms320 KiB
#include <bits/stdc++.h> #define FOR( i, x, n, d ) for( int i = x; i <= n; i += d ) #define int long long using namespace std; const int N = 1e5; signed main() { freopen("stones.in", "r", stdin); freopen("stones.out", "w", stdout); ios_base::sync_with_stdio(0), cin.tie(0); int n, sum1 = 0, sum2 = 0, max1 = 0, max2 = 0; cin >> n; FOR( i, 1, n, 1 ) { int x, tp; cin >> x >> tp; if( tp == 1 ) { sum1 += x + 1e12; max1 = max( max1, x ); } if( tp == 2 ) { sum2 += x + 1e12; max2 = max( max2, x ); } if( max1 > max2 ) { if( sum2 >= sum1 ) cout << "?"; else cout << ">"; } if( max2 > max1 ) { if( sum1 >= sum2 ) cout << "?"; else cout << "<"; } cout << '\n'; } }

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

stones.cpp: In function 'int main()':
stones.cpp:11:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   freopen("stones.in", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
stones.cpp:12:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   freopen("stones.out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...