結果

問題 No.2716 Falcon Method
ユーザー 矢澤式WINTER矢澤式WINTER
提出日時 2024-04-05 22:39:45
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,795 bytes
コンパイル時間 5,977 ms
コンパイル使用メモリ 310,820 KB
実行使用メモリ 8,476 KB
最終ジャッジ日時 2024-04-05 22:40:11
合計ジャッジ時間 21,609 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 8 ms
6,548 KB
testcase_07 AC 9 ms
6,548 KB
testcase_08 AC 8 ms
6,548 KB
testcase_09 AC 9 ms
6,548 KB
testcase_10 AC 8 ms
6,548 KB
testcase_11 AC 1,022 ms
8,340 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 827 ms
8,316 KB
testcase_22 AC 1,106 ms
8,476 KB
testcase_23 WA -
testcase_24 AC 1,114 ms
8,476 KB
testcase_25 AC 2 ms
6,548 KB
testcase_26 AC 2 ms
6,548 KB
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//*/
#include <atcoder/all>
using namespace atcoder;
//*/
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define ALL(x) (x).begin(),(x).end()
#define dbgv(x); for(auto now : x) cout << now << " "; cout << endl;
//using P = pair<int,int>;
using ll = long long;
using ull = unsigned long long;
//*/

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vint;

int op(int a,int b){return a+b;}
int e(){return 0;}
void solve(){
  /*/
  int n; cin >> n;
  vint a(n); rep(i,n) cin >> a[i];
  mint ans = 0,two = 2;
  rep(i,n) ans += (mint)(a[i])*two.pow(n-1);
  cout << ans.val() << endl;
  /*/
  ll n,q; cin >> n >> q;
  string s; cin >> s;
  segtree<int,op,e> d(n),r(n);
  rep(i,n){
    if(s[i] == 'D') d.set(i,1);
    else r.set(i,1);
  }
  rep(ssss,q){
    ll h,w,p; cin >> h >> w >> p;
    //swap(h,w);
    auto f = [&](ll x)->pair<ll,ll>{
      x = p+x;
      pair<ll,ll> res = {0,0};
      res.first = (x/n)*d.all_prod();
      res.second = (x/n)*r.all_prod();
      if(x%n){
        res.first += d.prod(0,x%n);
        res.second += r.prod(0,x%n);
      }
      if(p){
        res.first -= d.prod(0,p);
        res.second -= r.prod(0,p);
      }
      return res;
    };
    ll ac = 1e9,wa = 0;
    while(ac-wa>1){
      ll mid= (ac+wa)/2;
      auto [H,W] = f(mid);
      if(H >= h || W >= w) ac = mid;
      else wa = mid;
    }
    cout << (ac+p)%n << endl;
  }
  //*/
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1; //cin >> t;
  rep(_,t) solve();
} 
0