結果
| 問題 |
No.814 ジジ抜き
|
| コンテスト | |
| ユーザー |
Lepton_s
|
| 提出日時 | 2018-02-21 13:44:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 105 ms / 3,000 ms |
| コード長 | 968 bytes |
| コンパイル時間 | 636 ms |
| コンパイル使用メモリ | 74,996 KB |
| 最終ジャッジ日時 | 2025-01-05 08:24:38 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
23 | scanf("%d",&N);
| ~~~~~^~~~~~~~~
main.cpp:26:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
26 | rep(i, N) scanf("%lld%lld%d",&k[i],&l[i],&d[i]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <iostream>
#include <vector>
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)
using namespace std;
const ull cycle_per_sec = 2800000000;
ull begin_cycle;
ull get_cycle(){
unsigned int low, high;
__asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
return ((ull) low) | ((ull) high << 32);
}
double get_time(){
return (double) (get_cycle() - begin_cycle)/cycle_per_sec;
}
int main(){
//std::ios::sync_with_stdio(false);std::cin.tie(0);
int N;
scanf("%d",&N);
vector<ll> k(N), l(N);
vector<int> d(N);
rep(i, N) scanf("%lld%lld%d",&k[i],&l[i],&d[i]);
ll x = 0;
begin_cycle = get_cycle();
double t = get_time();
rep(i, N){
ll K = k[i], L = l[i], D = d[i];
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--;
}
}
cerr<<t<<endl;
cout<<x<<endl;
return 0;
}
Lepton_s