Submission #6491039
Source Code Expand
Copy
#include <iostream> #include <iomanip> #include <random> #include <algorithm> #include <vector> #include <set> #include <map> #include <cmath> #include <numeric> #include <cstdlib> #include <cstring> #include <deque> #include <sstream> #include <bitset> #include <cassert> #include <fstream> #define len(X) ((int)(X).size()) #ifdef __LOCAL #define DBG(X) cout << #X << "=" << (X) << endl; #else #define DBG(X) #define endl '\n' #endif using namespace std; using ll = long long int; using ull = unsigned long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; const int INT_INF = (int)(2e9); const ll LL_INF = (ll)(2e18); const ll mod = 1e9 + 7; const int NIL = -1; static mt19937 _g(time(nullptr)); inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); } inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }; template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); } template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; } template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; } void solve() { ll s; cin >> s; ll sq = sqrt(s); ll C = 57; for(ll x1 = sq - C; x1 <= sq + C; ++x1) { if(x1 < 0) continue; for(ll y2 = sq - C; y2 <= sq + C; ++y2) { if(y2 < 0) continue; ll rem = x1 * y2 - s; for(ll d = 1; d * d <= rem; ++d) { if(rem % d == 0) { ll x2 = d; ll y1 = rem / d; if(x2 <= (ll)1e9 && y1 <= (ll)1e9) { cout << "0 0 " << x1 << " " << y1 << " " << x2 << " " << y2 << endl; #ifdef __LOCAL assert(x1 * y2 - x2 * y1 == s); #endif exit(0); } } } } } } int main() { fast_io(); solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Triangle |
User | wYlkaTUOXcmdrLVt |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 2016 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt, sample-03.txt |
All | 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 1 ms | 256 KB |
01-02.txt | AC | 1 ms | 256 KB |
01-03.txt | AC | 1 ms | 256 KB |
01-04.txt | AC | 1 ms | 256 KB |
01-05.txt | AC | 1 ms | 256 KB |
01-06.txt | AC | 1 ms | 256 KB |
01-07.txt | AC | 1 ms | 256 KB |
01-08.txt | WA | 1 ms | 256 KB |
01-09.txt | WA | 1 ms | 256 KB |
01-10.txt | WA | 1 ms | 256 KB |
01-11.txt | WA | 1 ms | 256 KB |
01-12.txt | WA | 1 ms | 256 KB |
01-13.txt | WA | 1 ms | 256 KB |
sample-01.txt | AC | 1 ms | 256 KB |
sample-02.txt | AC | 1 ms | 256 KB |
sample-03.txt | AC | 1 ms | 256 KB |