結果
| 問題 |
No.814 ジジ抜き
|
| コンテスト | |
| ユーザー |
Lepton_s
|
| 提出日時 | 2018-02-20 17:38:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 100 ms / 3,000 ms |
| コード長 | 618 bytes |
| コンパイル時間 | 699 ms |
| コンパイル使用メモリ | 67,848 KB |
| 最終ジャッジ日時 | 2025-01-05 08:23:47 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%lld", &N);
| ~~~~~^~~~~~~~~~~~
main.cpp:17:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%lld%lld%lld", &K, &L, &D);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
// validator
#include <cstdio>
#include <iostream>
#include <cassert>
using namespace std;
typedef long long ll;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)
int main(){
ll N;
scanf("%lld", &N);
assert(1<=N&&N<=300000);
ll x = 0;
rep(i, N){
ll K, L, D;
scanf("%lld%lld%lld", &K, &L, &D);
assert(K>=1);
assert(0<=D&&D<=59);
assert(0<=L);
assert((ll)(L+(((__int128_t)(K-1))<<D))<=(ll)1e18);
ll L2 = L>>D;
while(K>0 && L2%4!=0){
x ^= L;
L += 1LL<<D;
L2++;
K--;
}
while(K%4!=0){
x ^= L+((K-1)<<D);
K--;
}
}
printf("%lld\n", x);
return 0;
}
Lepton_s