Submission #3621294
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2
// }}} 1
ll mod = INF+7;
// PowMod( base, index, modulo) return base ** index % modulo {{{
// PowMod = base ** index % mod ( natural numbers )
long long unsigned int PowMod( long long unsigned int base, long long unsigned int index, long long unsigned int modulo = mod ){
if( index == 0 ) return 1;
// O( log(index) )
if( index % 2 ){
return base * PowMod(base, index - 1, modulo) % modulo;
}else{
long long unsigned int Phalf = index / 2;
long long unsigned int half = PowMod(base, Phalf, modulo);
return half * half % modulo;
}
}
// }}}
struct trio{
int n1, n2, n3;
};
trio make_trio( int a, int b, int c ){
trio t = { a,b,c };
return t;
}
int main() {
int l;
Scd(l);
vector<trio> e;
Repe( i, 19, 1){
e.push_back( make_trio(i, i+1, PowMod(2,i-1) ));
e.push_back( make_trio(i, i+1, 0 ));
}
int reach = PowMod(2,18);
int from = 19;
while( l ){
if( l >= reach ){
l -= reach;
e.push_back( make_trio( from, 20, l ));
printf ("%d\n", l);
if( l == 1 ){
e.push_back( make_trio( 1, 20, 0 ));
break;
}
}else{
reach/=2;
from--;
}
}
printf("%d\n", reach);
int ans = e.size();
printf ("%d %d\n", 20, ans);
Rep( i, ans){
printf ("%d %d %d\n", e[i].n1, e[i].n2 , e[i].n3);
}
return 0;
}
Submission Info
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:69:11: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
Scd(l);
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 700 |
Status |
|
|
Set Name |
Test Cases |
Sample |
s1.txt, s2.txt |
All |
01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, s1.txt, s2.txt |
Case Name |
Status |
Exec Time |
Memory |
01.txt |
WA |
1 ms |
256 KB |
02.txt |
WA |
1 ms |
256 KB |
03.txt |
WA |
1 ms |
256 KB |
04.txt |
WA |
1 ms |
256 KB |
05.txt |
WA |
1 ms |
256 KB |
06.txt |
WA |
1 ms |
256 KB |
07.txt |
WA |
1 ms |
256 KB |
08.txt |
WA |
1 ms |
256 KB |
09.txt |
WA |
1 ms |
256 KB |
10.txt |
WA |
1 ms |
256 KB |
11.txt |
WA |
1 ms |
256 KB |
12.txt |
WA |
1 ms |
256 KB |
13.txt |
WA |
1 ms |
256 KB |
14.txt |
WA |
1 ms |
256 KB |
15.txt |
WA |
1 ms |
256 KB |
16.txt |
WA |
1 ms |
256 KB |
17.txt |
WA |
1 ms |
256 KB |
18.txt |
WA |
1 ms |
256 KB |
19.txt |
WA |
1 ms |
256 KB |
20.txt |
WA |
1 ms |
256 KB |
s1.txt |
WA |
1 ms |
256 KB |
s2.txt |
WA |
1 ms |
256 KB |