Submission #8511139


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
	#include <boost/multiprecision/cpp_int.hpp>
	#include <boost/multiprecision/cpp_dec_float.hpp>
	using bll = boost::multiprecision::cpp_int;
	using bdouble = boost::multiprecision::cpp_dec_float_100;
#endif
#ifdef LOCAL_DEV
	void debug_impl() { std::cerr << std::endl; }
	template<typename Head, typename... Tail> void debug_impl(Head head, Tail... tail) { std::cerr << " " << head << (sizeof...(tail) ? "," : ""); debug_impl(tail...); }
	#define debug(...) std::cerr << std::boolalpha << "(" << #__VA_ARGS__ << ") ="; debug_impl(__VA_ARGS__); std::cerr << std::noboolalpha;
#else
	#define debug(...)
#endif
#ifdef LOCAL_TEST
	#define BOOST_STACKTRACE_USE_ADDR2LINE
	#define BOOST_STACKTRACE_ADDR2LINE_LOCATION /usr/local/opt/binutils/bin/addr2line
	#define _GNU_SOURCE
	#include <boost/stacktrace.hpp>
	template<typename T> class dvector : public std::vector<T> {
	public:
		dvector() : std::vector<T>() {}
		explicit dvector(size_t n, const T& value = T()) : std::vector<T>(n, value) {}
		dvector(const std::vector<T>& v) : std::vector<T>(v) {}
		dvector(const std::initializer_list<T> il) : std::vector<T>(il) {}
		dvector(const typename std::vector<T>::iterator first, const typename std::vector<T>::iterator last) : std::vector<T>(first, last) {}
		dvector(const std::string::iterator first, const std::string::iterator last) : std::vector<T>(first, last) {}
		T& operator[](size_t n) {
			try { return this->at(n); } catch (const std::exception& e) {
				std::cerr << boost::stacktrace::stacktrace() << std::endl; return this->at(n);
			}
		}
		const T& operator[](size_t n) const {
			try { return this->at(n); } catch (const std::exception& e) {
				std::cerr << boost::stacktrace::stacktrace() << std::endl; return this->at(n);
			}
		}
	};
	class dbool {
	private:
		bool boolvalue;
	public:
		dbool() : boolvalue(false) {}
		dbool(bool b) : boolvalue(b) {}
		dbool(const dbool &b) : boolvalue(b.boolvalue) {}
		operator bool&() { return boolvalue; }
		operator const bool&() const { return boolvalue; }
	};
	template<typename T> std::ostream& operator<<(std::ostream& s, const dvector<T>& v) {
		for (int i = 0, len = v.size(); i < len; ++i){ s << v[i]; if (i < len - 1) s << "\t"; } return s; }
	template<typename T> std::ostream& operator<<(std::ostream& s, const dvector< dvector<T> >& vv) {
		for (int i = 0, len = vv.size(); i < len; ++i){ s << vv[i] << std::endl; } return s; }
	template<typename T> std::ostream& operator<<(std::ostream& s, const std::set<T>& se) {
		s << "{ "; for (auto itr = se.begin(); itr != se.end(); ++itr){ s << (*itr) << "\t"; } s << "}" << std::endl; return s; }
	template<typename T> std::ostream& operator<<(std::ostream& s, const std::multiset<T>& se) {
		s << "{ "; for (auto itr = se.begin(); itr != se.end(); ++itr){ s << (*itr) << "\t"; } s << "}" << std::endl; return s; }
	template<typename T1, typename T2> std::ostream& operator<<(std::ostream& s, const std::map<T1, T2>& m) {
		s << "{" << std::endl; for (auto itr = m.begin(); itr != m.end(); ++itr){ s << "\t" << (*itr).first << " : " << (*itr).second << std::endl; } s << "}" << std::endl; return s; }
	template<typename T1, typename T2> std::ostream& operator<<(std::ostream& s, const std::pair<T1, T2>& p) { 
		return s << "(" << p.first << ", " << p.second << ")"; }
	#define vector dvector
	#define bool dbool
#endif
//#define int long long
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#define p(var) std::cout<<var<<std::endl
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(v) (v).begin(), (v).end()
#define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
template<typename T> inline void pv(vector<T> &v) { for(ll i=0, N=v.size(); i<N; i++) std::cout << v[i] << " \n"[i==N-1]; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

/*-----8<-----template-----8<-----*/

/*-----8<-----library-----8<-----*/

const ll H_MAX = 3500;
const ll N_MAX = 3500;
const ll W_MAX = 3500;

ll N;

void solve() {
	scanf("%lld", &N);

	repeq(a,3500)repeq(b,3500){
		ll x=4*a*b-a*N-b*N;
		ll y=N*a*b;
		if(x>0 && y>0 && y%x==0){
			debug(a,b);
			cout<<a<<' '<<b<<' '<<y/x<<endl;
			return;
		}
	}
	
	
}

// https://atcoder.jp/contests/tenka1-2017/tasks/tenka1_2017_c
signed main() {
	solve();
	return 0;
}

Submission Info

Submission Time
Task C - 4/N
User kyon2326
Language C++14 (GCC 5.4.1)
Score 300
Code Size 5023 Byte
Status AC
Exec Time 5 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘void solve()’:
./Main.cpp:95:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &N);
                   ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 50
Set Name Test Cases
Sample 0002, 3485, 4664
All 0002, 0003, 0004, 0005, 0006, 0007, 0049, 0073, 0097, 0121, 0137, 0139, 0156, 0163, 0169, 0181, 0191, 0223, 0229, 0263, 0271, 0289, 0361, 0481, 0529, 0551, 0649, 0720, 0916, 1081, 1156, 1498, 1921, 2041, 2329, 2449, 2568, 2918, 2929, 3289, 3429, 3485, 3763, 4081, 4277, 4648, 4652, 4656, 4660, 4664
Case Name Status Exec Time Memory
0002 AC 1 ms 256 KB
0003 AC 1 ms 256 KB
0004 AC 1 ms 256 KB
0005 AC 1 ms 256 KB
0006 AC 1 ms 256 KB
0007 AC 1 ms 256 KB
0049 AC 1 ms 256 KB
0073 AC 1 ms 256 KB
0097 AC 1 ms 256 KB
0121 AC 1 ms 256 KB
0137 AC 1 ms 256 KB
0139 AC 1 ms 256 KB
0156 AC 1 ms 256 KB
0163 AC 1 ms 256 KB
0169 AC 1 ms 256 KB
0181 AC 1 ms 256 KB
0191 AC 1 ms 256 KB
0223 AC 1 ms 256 KB
0229 AC 1 ms 256 KB
0263 AC 1 ms 256 KB
0271 AC 1 ms 256 KB
0289 AC 1 ms 256 KB
0361 AC 1 ms 256 KB
0481 AC 1 ms 256 KB
0529 AC 1 ms 256 KB
0551 AC 2 ms 256 KB
0649 AC 2 ms 256 KB
0720 AC 2 ms 256 KB
0916 AC 2 ms 256 KB
1081 AC 2 ms 256 KB
1156 AC 2 ms 256 KB
1498 AC 2 ms 256 KB
1921 AC 2 ms 256 KB
2041 AC 3 ms 256 KB
2329 AC 3 ms 256 KB
2449 AC 3 ms 256 KB
2568 AC 3 ms 256 KB
2918 AC 3 ms 256 KB
2929 AC 3 ms 256 KB
3289 AC 4 ms 256 KB
3429 AC 4 ms 256 KB
3485 AC 4 ms 256 KB
3763 AC 4 ms 256 KB
4081 AC 4 ms 256 KB
4277 AC 5 ms 256 KB
4648 AC 5 ms 256 KB
4652 AC 5 ms 256 KB
4656 AC 5 ms 256 KB
4660 AC 5 ms 256 KB
4664 AC 5 ms 256 KB