#include #include #include using namespace std; typedef pair PII; #define x first #define y second // TLE // 通过了 8/11个数据 unordered_map _map; int main() { int n; scanf("%d", &n); for (int c = 0; c * c <= n; c++) for (int d = c; d * d + c * c <= n; d++) { int t = c * c + d * d; if (t > 5e6) continue; if (_map.count(t) == 0) _map[t] = {c, d}; } for (int a = 0; a * a <= n; a++) for (int b = a; b * b + a * a <= n; b++) { int t = n - a * a - b * b; if (t > 5e6) continue; if (_map.count(t)) { printf("%d %d %d %d", a, b, _map[t].x, _map[t].y); return 0; } } return 0; }