Submission #887282

#TimeUsernameProblemLanguageResultExecution timeMemory
887282abushbandit_1Weighting stones (IZhO11_stones)C++17
0 / 100
0 ms348 KiB
/* author : abushbandit contest : --- */ #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; #define int long long #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define ff first #define ss second #define pb push_back #define rep(i,s,f) for(int i = s;i < f;i++) #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #pragma GCC target("avx,avx2,fma") #pragma GCC optimize("Ofast,unroll-loops") template <class type1> using ordered_multiset = tree <type1, null_type, less_equal <type1>, rb_tree_tag, tree_order_statistics_node_update>; typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<pair<int,int>> vii; typedef pair<int,int> pii; const ll INF = 1e18; const ll MOD7 = 1e9 + 7; const ll MOD9 = 998244353; const ld PI = acos(-1.0); const int N = 1e5 + 2; template <class F, class _S> bool chmin(F &u, const _S &v){ bool flag = false; if ( u > v ){ u = v; flag |= true; } return flag; } template <class F, class _S> bool chmax(F &u, const _S &v){ bool flag = false; if ( u < v ){ u = v; flag |= true; } return flag; } int binpow (int a, int n) { int res = 1; while (n) { if (n & 1) res *= a; a *= a; n >>= 1; } return res; } void start_file(string file){ freopen((file + ".in").c_str(),"r",stdin); freopen((file + ".out").c_str(),"w",stdout); } void solve(int tc){ int n; cin >> n; set<int> st1,st2; for(int k = 0;k < n;k++){ int r,s; cin >> r >> s; if(s == 1){ st1.insert(r); } else{ st2.insert(r); } if(st2.size() > st1.size()){ if(st1.size() == 0){ cout << "<\n"; continue; } int cnt1 = 0,cnt2 = 0,cnt = st1.size(); auto j = (--st2.end()); for(auto i = (--st1.end());cnt > 0;i--){ if(*i > *j){ cnt1++; } else if(*i < *j){ cnt2++; } j--; cnt--; } if(cnt1 == 0){ cout << "<\n"; } else if(cnt2 == 0){ cout << ">\n"; } else{ cout << "?\n"; } } else{ if(st2.size() == 0){ cout << ">\n"; continue; } int cnt1 = 0,cnt2 = 0,cnt = st2.size(); auto j = (--st1.end()); for(auto i = (--st2.end());cnt > 0;i--){ if(*i > *j){ cnt2++; } else if(*i < *j){ cnt1++; } cnt--; j--; } if(cnt1 == 0){ cout << "<\n"; } else if(cnt2 == 0){ cout << ">\n"; } else{ cout << "?\n"; } } } } signed main(){ // start_file(""); ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); int test_cases = 1; // cin >> test_cases ; for(int tc = 1;tc <= test_cases;++ tc){ solve(tc); } } /* */

Compilation message (stderr)

stones.cpp: In function 'void start_file(std::string)':
stones.cpp:75:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   75 |  freopen((file + ".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stones.cpp:76:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   76 |  freopen((file + ".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...