提出 #66966163
ソースコード 拡げる
/* Omhari */
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi2,lzcnt,popcnt")
#include<bits/stdc++.h>
#include<chrono>
using namespace std::chrono;
using namespace std;
//ordered_set s;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//------------------------------------Define------------------------------------------------------
#define F first
#define S second
#define int long long // Warning
#define ll long long
#define db long double
#define ST string
#define NA ST::npos //Not found in string
#define pb push_back
#define Pb pop_back
#define mp make_pair
#define el "\n"
#define vi vector <int>
#define vt vector
#define pii pair <int, int>
#define mii map<int, int>
#define NF(v) v.end()
#define sz(v) (ll)(v.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define is_sort(v) is_sorted (all(v))
#define max_of(v) *max_element (all(v))
#define min_of(v) *min_element (all(v))
#define itos(s) to_string(s)
#define cntone(x) __builtin_popcountll(x) // 64-bit
#define cntzro(x) __builtin_clzll(x) // 64-bit
#define clr(x,y) memset(x, y, sizeof(x))
#define fil(x,y) fill(all(x), y)
#ifdef Omhari
#define deb(x) cerr<<#x<<" = "; dprint(x); cerr<<endl;
#else
#define deb(x);
#endif
#define For(i, a, b) for(int i=a; i<b; i++)
#define Forr(i, a, b) for(int i=a; i>=b; i--)
#define Foo(it, box) for(auto &it:box)
#define OK(l, r, val) assert(l<=val && val<=r)
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
//ordered_set s;
// template<typename T> using oset = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
//------------------------------------------------------------------------------------------------
//-------------------------------------Constant---------------------------------------------------
const db PI = acos(-1.0);
const ll mod = 1e9+7;
const ll mod1 = 998244353;
const int inf = INT_MAX>>1;
const ll oo = LLONG_MAX>>1;
const int dx[8] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[8] = {0, 0, 1, -1, 1, -1, -1, 1};
// {R, L, U, D, RD, RU, LU, LD}
/*
Some Big Prime numbers, can be used for hasing
Prime no. Order
-----------------------------------
10000000019 10^10
100000000003 10^11
1000000000039 10^12
10000000000037 10^13
100000000000031 10^14
1000000000000037 10^15
10000000000000061 10^16
*/
//------------------------------------------------------------------------------------------------
//------------------------------------Functions---------------------------------------------------
// IncStackSize();
// #include <sys/resource.h>
// void IncStackSize()
// {
// rlimit R;
// getrlimit(RLIMIT_STACK, &R);
// R.rlim_cur = R.rlim_max;
// setrlimit(RLIMIT_STACK, &R);
// }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll A, ll B) {return uniform_int_distribution<ll>(A, B)(rng);}
ll nCr(ll n, ll r) { if(n<r) return 0; ll ans=1; if(r>n-r) r=n-r;
for(ll i=1; i<=r; i++) ans*=(n-i+1), ans/=i; return ans;}
int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b);}
inline ll addM(ll a, ll b, ll m) { return ((a % m) + (b % m)) % m; }
inline ll subM(ll a, ll b, ll m) { return ((a % m) - (b % m) + m) % m; }
inline ll mulM(ll a, ll b, ll m) { return ((a % m) * (b % m)) % m; }
inline ll powM(ll a, ll b, ll m) { ll ans = 1; a %= m; while (b) { if (b & 1)
ans = (a * ans) % m; a = (a * a) % m; b >>= 1; } return ans; }
inline ll divM(ll a, ll b, ll m) { return mulM(a, powM(b, m-2, m), m); }
inline void yes(bool ok, bool capital=true) { if (capital) { if (ok) cout << "YES\n";
else cout << "NO\n"; } else{ if (ok) cout << "Yes\n"; else cout << "No\n"; } }
//Miller-Rabin
bool _isPrime(ll n){ if(n<2) return false; for(ll x:{2,3,5,7,11,13,17,19,23,29,31,37}) {
if(n==x) return true; bool flag=true; ll r=1, d=1;
while(r<=((n-1)>>__builtin_ctzll(n-1))) { if(r&((n-1)>>__builtin_ctzll(n-1))) d=((__int128)d*x)%n;
x=((__int128)x*x)%n; r<<=1; } if(d==1||d==n-1) flag=false;
for(r=0;r<__builtin_ctzll(n-1);r++) { d=((__int128)d*d)%n; if(d==n-1) flag=false; }
if(flag) return false; } return true; }
//Sieve of Eratosthenes
const int MXP = 1000'005;
// vector<int> prime;
void getPrime()
{
// prime.resize(MXP);
// for (int i = 0; i < MXP; i++)
// prime[i] = i;
bitset<MXP> isprime(0);
isprime[0] = isprime[1] = 1;
for (int i = 2; i * i < MXP; i++)
{
if (isprime[i] == 0)
{
for (int j = i * i; j < MXP; j += i)
{
isprime[j] = 1;
// if(prime[j]==j)
// prime[j]=i;
}
}
}
// prime.push_back(2);
// for(int i=3; i<MXP; i+=2)
// if(!isprime[i])
// prime.pb(i);
}
//-----------------------------------------------------------------------------------------------
//------------------------------------Template---------------------------------------------------
//Vector input
template <typename T> istream &operator>>(istream &in, vector<T> &vec)
{for (auto &v : vec) in>>v; return in;}
//Vector output
template <typename T> ostream& operator<<(ostream &out, vector<T> &vec)
{for (auto &v : vec) out<<v<<" "; return out;}
//Pair input
template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a)
{in>>a.first>>a.second;return in;}
//Pair output
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a)
{out<<a.first<<" "<<a.second;return out;}
template<class T> void read(T& x) { cin >> x; }
template<class H, class... T> void read(H& h, T&... t) { read(h); read(t...); }
template<class T> void write(T& x) { cout << x <<" "; }
template<class H, class... T> void write(H& h, T&... t) { write(h); write(t...); }
template<class T> inline T ceil(T a, T b){return (a + b - 1)/b;}
//Priority_Queue
template<typename T> using mnHeap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using mxHeap = priority_queue<T>;
//Unordered set and map
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;
//multi set and map
template<typename T> using mset = multiset<T>;
template<typename T1, typename T2> using mmap = multimap<T1, T2>;
//Debugging
void dprint(int64_t t) {cerr << t;}
void dprint(int32_t t) {cerr << t;}
void dprint(string t) {cerr << t;}
void dprint(char t) {cerr << t;}
void dprint(long double t) {cerr << t;}
void dprint(double t) {cerr << t;}
void dprint(unsigned long long t) {cerr << t;}
template <class T1, class T2> void dprint(pair <T1, T2> p);
template <class T> void dprint(vector <T> v);
template <size_t T> void dprint(const bitset<T> &t) { cerr << t; }
template <class T> void dprint(set <T> v);
template <class T> void dprint(multiset <T> v);
template <class T1, class T2> void dprint(map <T1, T2> v);
template <class T1, class T2> void dprint(multimap <T1, T2> v);
template <class T1, class T2> void dprint(pair <T1, T2> a)
{cerr << "{"; dprint(a.first); cerr << ", "; dprint(a.second); cerr << "}";}
template <class T> void dprint(vector <T> v) {cerr << "[ "; for (T i : v)
{dprint(i); cerr << " ";} cerr << "]";}
template <class T> void dprint(set <T> v)
{cerr << "[ "; for (T i : v) {dprint(i); cerr << " ";} cerr << "]";}
template <class T> void dprint(multiset <T> v)
{cerr << "[ "; for (T i : v) {dprint(i); cerr << " ";} cerr << "]";}
template <class T1, class T2> void dprint(map <T1, T2> v)
{cerr << "[ "; for (auto i : v) {dprint(i); cerr << " ";} cerr << "]";}
template <class T1, class T2> void dprint(multimap <T1, T2> v)
{cerr << "[ "; for (auto i : v) {dprint(i); cerr << " ";} cerr << "]";}
// template <class T> void dprint(oset<T> &v)
// {cerr<<"[ ";for(T i: v){dprint(i);cerr<<" ";}cerr << "]";}
//------------------------------------------------------------------------------------------------
struct Node
{
ST s;
Node *next;
Node(){
s="";
next=NULL;
}
Node(ST ss){
s=ss;
next=NULL;
}
};
void solve()
{
int n, q; cin>>n>>q;
vector<Node*> pos(n+1, new Node());
For(__, 0, q)
{
int type, idx; cin>>type>>idx;
if(type==1)
{
pos[idx]=pos[0];
}
else if(type==2)
{
ST ss; cin>>ss;
reverse(all(ss));
Node* node=new Node(ss);
node->next=pos[idx];
pos[idx]=node;
}
else
{
pos[0]=pos[idx];
}
}
ST ans="";
Node* temp=pos[0];
while(temp)
{
for(char &ch:temp->s)
ans.push_back(ch);
temp=temp->next;
}
reverse(all(ans));
cout<<ans;
}
int32_t main()
{
FAST;
#ifdef Omhari
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
// IncStackSize();
auto start=high_resolution_clock::now();
// cout<<fixed<<setprecision(20);
/***************-Multiple test case-***************/
int T=1;
// cin>>T;
for(int ii=1; ii<=T; ii++)
{
// cout<<"Case #"<<ii<<": ";
solve();
}
auto stop=high_resolution_clock::now();
auto duration=duration_cast<milliseconds>(stop - start);
#ifdef Omhari
cerr << "Time: " << duration.count() << " ms" << endl;
#endif
return 0;
}
提出情報
提出日時
2025-06-21 22:03:01+0900
問題
D - Conflict 2
ユーザ
omhari
言語
C++ 20 (gcc 12.2)
得点
425
コード長
10216 Byte
結果
AC
実行時間
39 ms
メモリ
17692 KiB
コンパイルエラー
Main.cpp: In function ‘long long int nCr(long long int, long long int)’:
Main.cpp:95:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
95 | for(ll i=1; i<=r; i++) ans*=(n-i+1), ans/=i; return ans;}
| ^~~
Main.cpp:95:46: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
95 | for(ll i=1; i<=r; i++) ans*=(n-i+1), ans/=i; return ans;}
| ^~~~~~
Main.cpp: In function ‘long long int powM(long long int, long long int, long long int)’:
Main.cpp:100:68: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
100 | inline ll powM(ll a, ll b, ll m) { ll ans = 1; a %= m; while (b) { if (b & 1)
| ^~
Main.cpp:101:22: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
101 | ans = (a * ans) % m; a = (a * a) % m; b >>= 1; } return ans; }
| ^
Main.cpp: In function ‘bool _isPrime(long long int)’:
Main.cpp:108:1: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
108 | if(n==x) return true; bool flag=true; ll r=1, d=1;
| ^~
Main.cpp:108:23: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
108 | if(n==x) return true; bool flag=true; ll r=1, d=1;
| ^~~~
ジャッジ結果
セット名
Sample
All
得点 / 配点
0 / 0
425 / 425
結果
セット名
テストケース
Sample
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 02_random2_12.txt, 02_random2_13.txt, 02_random2_14.txt, 02_random2_15.txt, 03_random3_00.txt, 03_random3_01.txt, 03_random3_02.txt, 03_random3_03.txt, 04_random4_00.txt, 04_random4_01.txt, 05_random5_00.txt, 05_random5_01.txt, 06_handmade_00.txt, 06_handmade_01.txt, 06_handmade_02.txt, 06_handmade_03.txt, 06_handmade_04.txt, 06_handmade_05.txt
ケース名
結果
実行時間
メモリ
00_sample_00.txt
AC
1 ms
3428 KiB
00_sample_01.txt
AC
1 ms
3848 KiB
00_sample_02.txt
AC
1 ms
3456 KiB
01_random_00.txt
AC
4 ms
5164 KiB
01_random_01.txt
AC
19 ms
6612 KiB
01_random_02.txt
AC
20 ms
6280 KiB
01_random_03.txt
AC
2 ms
4696 KiB
01_random_04.txt
AC
20 ms
7808 KiB
01_random_05.txt
AC
6 ms
4788 KiB
01_random_06.txt
AC
3 ms
4696 KiB
01_random_07.txt
AC
5 ms
4328 KiB
01_random_08.txt
AC
16 ms
6028 KiB
01_random_09.txt
AC
19 ms
6280 KiB
01_random_10.txt
AC
17 ms
6208 KiB
01_random_11.txt
AC
6 ms
3980 KiB
01_random_12.txt
AC
15 ms
7068 KiB
01_random_13.txt
AC
15 ms
6348 KiB
01_random_14.txt
AC
18 ms
5976 KiB
01_random_15.txt
AC
14 ms
5584 KiB
02_random2_00.txt
AC
26 ms
9512 KiB
02_random2_01.txt
AC
26 ms
9516 KiB
02_random2_02.txt
AC
27 ms
9388 KiB
02_random2_03.txt
AC
27 ms
9512 KiB
02_random2_04.txt
AC
35 ms
12144 KiB
02_random2_05.txt
AC
34 ms
11200 KiB
02_random2_06.txt
AC
31 ms
9936 KiB
02_random2_07.txt
AC
24 ms
7156 KiB
02_random2_08.txt
AC
38 ms
13024 KiB
02_random2_09.txt
AC
35 ms
11268 KiB
02_random2_10.txt
AC
33 ms
9604 KiB
02_random2_11.txt
AC
22 ms
5832 KiB
02_random2_12.txt
AC
39 ms
16208 KiB
02_random2_13.txt
AC
34 ms
11648 KiB
02_random2_14.txt
AC
31 ms
10504 KiB
02_random2_15.txt
AC
18 ms
4520 KiB
03_random3_00.txt
AC
29 ms
11484 KiB
03_random3_01.txt
AC
30 ms
11644 KiB
03_random3_02.txt
AC
30 ms
11572 KiB
03_random3_03.txt
AC
23 ms
10080 KiB
04_random4_00.txt
AC
28 ms
11600 KiB
04_random4_01.txt
AC
29 ms
11552 KiB
05_random5_00.txt
AC
34 ms
17580 KiB
05_random5_01.txt
AC
38 ms
17692 KiB
06_handmade_00.txt
AC
1 ms
3464 KiB
06_handmade_01.txt
AC
7 ms
6828 KiB
06_handmade_02.txt
AC
17 ms
4520 KiB
06_handmade_03.txt
AC
32 ms
14208 KiB
06_handmade_04.txt
AC
17 ms
4584 KiB
06_handmade_05.txt
AC
21 ms
9728 KiB