結果
| 問題 | No.48 ロボットの操縦 |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-11-23 16:39:09 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 5,000 ms |
| + 825µs | |
| コード長 | 2,807 bytes |
| 記録 | |
| コンパイル時間 | 3,879 ms |
| コンパイル使用メモリ | 371,760 KB |
| 実行使用メモリ | 9,868 KB |
| 最終ジャッジ日時 | 2026-11-23 16:39:15 |
| 合計ジャッジ時間 | 5,796 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
//Maqsad Nahi Bhoolna
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using max_heap = priority_queue<T>;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//find_by_order(k): returns iterator to k-th smallest element (0-based)
//order_of_key(x): returns number of elements strictly less than x
#define ll long long int
#define ld long double
#define nl cout<<"\n"
#define re return 0
#define fs first
#define sc second
#define MOD 1000000007
#define pii pair<ll,ll>
#define vl vector<ll>
#define vll vector<vector<ll>>
#define vpii vector<pair<ll,ll>>
#define vvpii vector<vector<pair<ll,ll>>>
#define vb vector<bool>
#define vbb vector<vector<bool>>
#define vc vector<char>
#define vcc vector<vector<char>>
#define vs vector<string>
#define vss vector<vector<string>>
#define all(vec) vec.begin(), vec.end()
#define allr(vec) vec.rbegin(), vec.rend()
#define sahi(vec) sort(vec.begin(),vec.end())
#define ulta(vec) sort(vec.rbegin(),vec.rend())
#define fori(a,b) for(ll i=a;i<b;i++)
#define forj(a,b) for(ll j=a;j<b;j++)
#define fork(a,b) for(ll k=a;k<b;k++)
#define forr(a,b) for(ll r=a;r>=b;r--)
#define yes(expr) (expr)? cout<<"yes" : cout<<"no"
#define Yes(expr) (expr)? cout<<"Yes" : cout<<"No"
#define YES(expr) (expr)? cout<<"YES" : cout<<"NO"
#define print(vec) for(auto x : vec) cout<<x<<" "
#define io ios_base::sync_with_stdio(false);cin.tie(nullptr)
template <typename A, typename B>
istream& operator>>(istream &in, pair<A,B> &p) {
in >> p.first >> p.second;
return in;
}
template <typename T>
istream& operator>>(istream &in, vector<T> &v) {
for (auto &x : v) in >> x;
return in;
}
template <typename A, typename B>
ostream& operator<<(ostream &out, const pair<A,B> &p) {
out << p.first << " " << p.second;
return out;
}
template <typename T>
ostream& operator<<(ostream &out, const vector<T> &v) {
for (auto &x : v) out << x << " ";
return out;
}
int main()
{
io;
ll x,y,l;
cin>>x>>y>>l;
ll ans = 0;
if(y>0)
{
ans += y/l;
if(y%l!=0)
ans++;
}
bool f = false;
if(x!=0)
{
ans++;
f = true;
x = abs(x);
ans += x/l;
if(x%l!=0)
ans++;
}
if(y<0)
{
if(not f)
{
ans += 2;
}
else
{
ans++;
}
y = abs(y);
ans += y/l;
if(y%l!=0)
ans++;
}
cout<<ans;
nl;
return 0;
}
vjudge1