結果
問題 | No.2208 Linear Function |
ユーザー |
|
提出日時 | 2023-04-28 13:03:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 2,305 bytes |
コンパイル時間 | 1,973 ms |
コンパイル使用メモリ | 199,812 KB |
最終ジャッジ日時 | 2025-02-12 14:41:15 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 |
ソースコード
#include <bits/stdc++.h>using namespace std;//#include <atcoder/all> //atcoder//using namespace atcoder; //atcoder#pragma GCC optimize("Ofast")#pragma GCC optimize("unroll-loops")#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")using ll = long long;using ld = long double;using vi = vector<int>;using vl = vector<long long>;using vc = vector<char>;using vs = vector<string>;using vb = vector<bool>;using vd = vector<double>;using vld = vector<long double>;using vvi = vector<vector<int>>;using vvl = vector<vector<long long>>;using vvc = vector<vector<char>>;using vvs = vector<vector<string>>;using vvb = vector<vector<bool>>;using vvd = vector<vector<double>>;using vvld = vector<vector<long double>>;using Graph = vector<vector<int>>;using Nodes = pair<int,int>;// using pri = priority_queue<ll>; //最大値// using pri = priority_queue<ll, vector<ll>, greater<ll>>; //最小値#define _GLIBCXX_DEBUG#define endl "\n"#define rep(i, n) for (int i = 0; i < (int)(n); i++)#define ALL(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)#define all(x) (x).begin(), (x).end()#define rall(x) (x).rbegin(), (x).rend()const int INF = 1e9;const int MININF = -1e9;const ll LINF = 1e18;const ll MINLINF = -1e18;const int MOD = 1e9+7;const int MODD = 998244353;const char maru = 'o';const char batu = 'x';// 8方向(4方向ならN=4で止め。)vi vx={0, 1, 0, -1, 1, 1, -1, -1};vi vy={1, 0, -1, 0, 1, -1, -1, 1};// a<bならaをbに更新template <class T>bool chmax(T &a, const T& b){if(a<b){a=b;return true;}return false;}// a>bならaをbに更新template <typename T>bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}// 最大公約数template<typename T>T gcd(T A,T B){if(B==0)return A;return gcd(B,A%B);}// 最小公倍数template<typename T>T lcm(T A, T B){return A / gcd(A, B) * B;}int main(){ios::sync_with_stdio(false);cin.tie(nullptr);int T; cin>>T;rep(i,T){int L,R,A,B; cin>>L>>R>>A>>B;int ans=MININF;for(int j=L;j<=R;j++){chmax(ans,A*j+B);}cout<<ans<<endl;}}