Submission #1026209

#TimeUsernameProblemLanguageResultExecution timeMemory
1026209_rain_Best Place (NOI17_bestplace)C++14
100 / 100
30 ms4048 KiB
#include<bits/stdc++.h> using namespace std; mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); namespace Random { #define int long long int Rand(int l , int r) { return uniform_int_distribution<int>(l , r)(rng); } #undef int } using i64 = long long; using ui64 = unsigned long long; #define MASK(x) ((i64)(1) << (x)) #define BIT(mask , x) (((mask) >> (x)) & (1)) #define sz(x) (x).size() #define all(x) (x).begin() , (x).end() #define FOR(i ,a , b) for (int i = (a); i <= (b); ++i) #define FORD(i , a , b) for (int i = (b); i >= (a); --i) #define REP(i , a , b) for (int i = (a); i < (b); ++i) #define REPD(i , a , b) for (int i = (b) - 1 ; i >= (a); --i) template <class T> void compress(vector<T> &a) { sort(a.begin() , a.end()); a.resize(unique(a.begin() , a.end()) - a.begin()); return; } template<class T> void printArr(T& container , string separator = "" , string finish = "\n") { for (auto& item : container) cout << item << separator; cout << finish; } template<class T> bool maximize(T &a , T b) {if (a < b) return a = b , true; else return false;} template<class T> bool minimize(T &a , T b) {if (a > b) return a = b , true; else return false;} template<class T> T gcd(T x , T y) {while (y) swap(y , x %= y); return x;} template<class T> T lcm(T x , T y) {return (x * y) / gcd(x , y);} //... INPUT void INPUT(string name) { iostream::sync_with_stdio(false); cin.tie(0); if (!fopen((name + ".inp").c_str() , "r")) return; freopen((name + ".inp").c_str() , "r" , stdin); freopen((name + ".out").c_str() , "w+" , stdout); return; } const int maxn = 1e5; int x[maxn + 2] , y[maxn + 2] , n; int32_t main() { INPUT("main"); cin >> n; vector<int> valuex,valuey; FOR(i,1,n) { cin >> x[i] >> y[i]; valuex.push_back(x[i]); valuey.push_back(y[i]); } sort(all(valuex)); sort(all(valuey)); // compress(valuex); // compress(valuey); int xx = (sz(valuex) + 1) / 2 - 1; int yy = (sz(valuey) + 1) / 2 - 1; cout << valuex[xx] << ' ' << valuey[yy] << '\n'; cerr << "\nTIME RUN : " << 1000 * clock() / CLOCKS_PER_SEC << "MS\n"; return 0; }

Compilation message (stderr)

bestplace.cpp: In function 'void INPUT(std::string)':
bestplace.cpp:55:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |      freopen((name + ".inp").c_str() , "r" , stdin);
      |      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bestplace.cpp:56:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   56 |      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...
#Verdict Execution timeMemoryGrader output
Fetching results...