제출 #655829

#제출 시각아이디문제언어결과실행 시간메모리
655829ThamognyaKodiBest Place (NOI17_bestplace)C++14
100 / 100
36 ms3920 KiB
/*Start of document*/ #include <bits/stdc++.h> /* in bits/stdc++.h add `#define thamognyaLocal 1` - does not work or add to CMakeLists.txt set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -DthamognyaLocal") or -DthamognyaLocal to compiler cmakelist: cmake_minimum_required(VERSION 3.23) project(CompetitveCodingWorkspace) set(CMAKE_CXX_STANDARD 17) add_executable(CompetitveCodingWorkspace main.cpp) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -DthamognyaLocal") */ using namespace std; /*General Optimization - Start*/ #pragma optimization_level 3 #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") // #pragma GCC target("avx,avx2,fma") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") /*General Optimization - Start*/ /*Shortcut Datatypes - start*/ typedef long long lll; typedef long long int ll; typedef long double ld; typedef vector<ll> vl; #define int long long int /*Shortcut Datatypes - end*/ /*Quick Shorthands - Start*/ /**Simple Shorthands - Start**/ #define sza(x) ((ll)x.size()) #define all(a) (a).begin(), (a).end() #define pb push_back #define mp make_pair #define f first #define s second /**Simple Shorthands - Stop**/ /**long Shorthands - Start**/ // for loops #define fir(i, a, b) for (ll i = a; i <= b; i++) #define fpr(i, b) for (ll i = 0; i < b; i++) // vector inputs #define aiv(a, n, T) vector<T> a(n); for (ll i = 0; i < n; i++) {cin >> a[i];} #define av(a, n) vector<ll> a(n); for (ll i = 0; i < n; i++) {cin >> a[i];} // cout #define cout(whatever) cout << whatever << flush #define print(whatever) cout << whatever << endl #define fix(prec) cout << setprecision(prec) << fixed // vectors #define vl vector<ll> // long funcs #define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());} /**long Shorthands - End**/ /*Quick Shorthands - Start*/ /*Constants - Start*/ #define PI 3.1415926535897932384626433832795l const ll MAX_N = 1e5 + 5; const ll MOD = 1e9 + 7; const ll INF = 1e9; const ld EPS = 1e-9; /*Constants - End*/ /*Basic Func - Start*/ bool isPrime(ll b) { // i^2 rule if (b == 1) return false; for (ll i = 2; i * i <= b; i++) if (b % i == 0) return false; return true; } ll factorial(ll n) { // iterative with memory if (n == 0) return 1; vector<ll> tmp; tmp.push_back(1); for (ll i = 1; i <= n; i++) tmp.push_back(tmp[i - 1] * i); return tmp[n]; } ll gcd(ll a, ll b) { // just an alias sort of return __gcd(a, b); } /*Basic Func - End*/ /*Open Files - Start*/ void usaco(string filename) { freopen((filename + ".in").c_str(), "r", stdin); freopen((filename + ".out").c_str(), "w", stdout); } void openFile(string input, string output) { freopen(input.c_str(), "r", stdin); freopen(output.c_str(), "w", stdout); } /*Open Files - End*/ /*Global Var - Start*/ // comment if you do not need it /*Global Var - End*/ /*Solution - Start*/ ll dist(ll x, ll x1, ll y, ll y1) { return abs(x - x1) + abs(y - y1); } void solve(ll tt) { ll n; cin >> n; vl x(n), y(n); fpr(i, n) cin >> x[i] >> y[i]; sort(all(x)), sort(all(y)); print(x[n / 2] << " " << y[n / 2]); } int32_t main(void) { #ifdef thamognyaLocal auto begin = chrono::high_resolution_clock::now(); #endif ios::sync_with_stdio(false); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin.tie(NULL); cout.tie(NULL); // usaco("cowland"); // openFile("input.txt", "output.txt"); #ifdef thamognyaLocal // usaco("working"); #endif ll tc = 1; #ifdef inputNeeded cin >> tc; for (ll t = 1; t <= tc; t++) solve(t); #else solve(tc); #endif #ifdef thamognyaLocal auto end = chrono::high_resolution_clock::now(); cout(setprecision(4) << fixed); print("Execution time: " << chrono::duration_cast<chrono::duration<double>>(end - begin).count() << " seconds"); #endif } /*Solution - End*/ /*End of document*/

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

bestplace.cpp:16: warning: ignoring '#pragma optimization_level ' [-Wunknown-pragmas]
   16 | #pragma optimization_level 3
      | 
bestplace.cpp: In function 'void usaco(std::string)':
bestplace.cpp:86:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   86 |     freopen((filename + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bestplace.cpp:87:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   87 |     freopen((filename + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bestplace.cpp: In function 'void openFile(std::string, std::string)':
bestplace.cpp:90:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   90 |     freopen(input.c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
bestplace.cpp:91:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   91 |     freopen(output.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...