結果

問題 No.2716 Falcon Method
ユーザー 矢澤式WINTER矢澤式WINTER
提出日時 2024-04-05 22:39:45
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,795 bytes
コンパイル時間 4,483 ms
コンパイル使用メモリ 309,856 KB
実行使用メモリ 8,480 KB
最終ジャッジ日時 2024-10-01 02:48:04
合計ジャッジ時間 17,682 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16 WA * 12
権限があれば一括ダウンロードができます

ソースコード

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