Submission #39599483
Source Code Expand
/*
_oo0oo_
o8888888o
88" . "88
(| -_- |)
0\ = /0
___/`---'\___
.' \\| |// '.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
| \_| ''\---/'' |_/ |
\ .-\__ '-' ___/-. /
___'. .' /--.--\ `. .'___
."" '< `.___\_<|>_/___.' >' "".
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `_. \_ __\ /__ _/ .-` / /
=====`-.____`.___ \_____/___.-`___.-'=====
`=---='
*/
// **************************************************************************** //
// //
// ::: :::::::: //
// :+: :+: :+: //
// +:+ +:+ +:+ //
// +//+ +:+ +//+ //
// +//+//+//+//+//+ +//+ //
// //+// //+// //
// //# ########.fr //
// //
// **************************************************************************** //
#include <bits/stdc++.h>
using namespace std;
//#define s(n) scanf("%d",&n)
#define s2(a,b) scanf("%d%d",&a,&b)
#define s3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sc(n) scanf("%c",&n)
#define sl(n) scanf("%I64d",&n)
#define sf(n)
//----------------------------------------------- --------------------------------------------
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using str = string;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<ll>;
using vd = vector<db>;
using vs = vector<str>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vpd = vector<pd>;
#define tcT template<class T
#define tcTU tcT, class U
tcT> using V = vector<T>;
tcT, size_t SZ> using AR = array<T,SZ>;
tcT> using PR = pair<T,T>;
#define sz(x) int((x).size())
#define bg(x) begin(x)
#define all(x) bg(x), end(x)
#define rall(x) x.rbegin(), x.rend()
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pb push_back
#define eb emplace_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define FOR(i,a,b) for (int (i) = (a); (i) < (b); ++(i))
#define REP(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int (i) = (b)-1; (i) >= (a); --(i))
#define PER(i,a) ROF(i,0,a)
#define rep(a) REP(_,a)
#define each(a,x) for (auto& a: x)
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);} //__gcd
ll lcm(ll a, ll b){return (a/gcd(a,b)*b);}
ll moduloMultiplication(ll a,ll b,ll mod){ll res = 0;a %= mod;while (b){if (b & 1)res = (res + a) % mod;b >>= 1;}return res;}
ll powermod(ll x, ll y, ll p){ll res = 1;x = x % p;if (x == 0) return 0;while (y > 0){if (y & 1)res = (res*x) % p;y = y>>1;x = (x*x) % p;}return res;}
bool isPrime(ll n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
bool isPowerOfTwo(int n){if(n==0)return false;return (ceil(log2(n)) == floor(log2(n)));}
bool isPerfectSquare(ll x){if (x >= 0) {ll sr = sqrt(x);return (sr * sr == x);}return false;}
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD = 1e9+7;
const int MX = 2e5+5;
const ll INF = 1e18;
const db PI = acos((db)-1);
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem
tcT> bool ckmin(T& a, const T& b) {
return b < a ? a = b, 1 : 0; } // set a = min(a,b)
tcT> bool ckmax(T& a, const T& b) {
return a < b ? a = b, 1 : 0; }
tcT> void remDup(vector<T>& v) { // sort and remove duplicates
sort(all(v)); v.erase(unique(all(v)),end(v)); }
// Some Codes Skipped
inline namespace FileIO {
void setIn(str s) {freopen(s.c_str(),"r",stdin);}
void setOut(str s) {freopen(s.c_str(),"w",stdout);}
void setIO(str s = "") {
cin.tie(0)->sync_with_stdio(0); // unsync C / C++ I/O streams
// cin.exceptions(cin.failbit);
// throws exception when do smth illegal
// ex. try to read letter into int
if (sz(s)) setIn(s+".in"), setOut(s+".out"); // for old USACO
}
}
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
// http://xorshift.di.unimi.it/splitmix64.c
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};
#define Code ios_base::sync_with_stdio(false);
#define By cin.tie(NULL);
#define Sudhir cout.tie(NULL);
#define vll vector<long long int>
const int NUM = 31;
#define int long long
#define intd long double
#define pi 3.141592653589793238
#define ff first
#define ss second
#define umap unordered_map<int, int>
#define vi vector<int>
#define pii pair<int, int>
#define all1(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define allr1(v) (v).rbegin()+1,(v).rend()
#define sort0(v) sort(all(v))
#define setBits(x) __builtin_popcount(x)
#define pb push_back
#define ppb pop_back
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> > #define ini(a, i) memset(a, i, sizeof(a))
// #define lb lower_bound #define ub upper_bound
#define py cout<<"YES\n"; #define pm cout<<"-1\n";
#define pn cout<<"NO\n"; #define ASCII_SIZE 256
#define pb push_back
#define fr(a,b) for(int i = a; i < b; i++)
#define mod 1000000007 #define inf (1LL<<60) #define prDouble(x) cout << fixed << setprecision(10) << x #define triplet pair<ll,pair<ll,ll>>
#define echo(p) cout << p <<endl;
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define read(x) int x; cin >> x;
#define reads(x) string x; cin >> x;
using namespace std;
void init_code(){
fast_io;
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
}
bool is_palindrome(const string& s) {
string rev = s;
reverse(rev.begin(), rev.end());
return s == rev;
}
const int MAXN = 1e5;
// int n, a[MAXN + 5], ans[MAXN + 5];
void solvve(){
unordered_map<long long, int, custom_hash> safe_map;
// gp_hash_table<long long, int, custom_hash> safe_hash_table;
string S;
cin >> S;
for (int i = 0; i < S.size(); i += 2) {
swap(S[i], S[i+1]);
}
cout << S << endl;
}
signed main()
{
init_code();
// read(t)
// while (t--) {
solvve();
// cout<<endl;
return 0;
}
Submission Info
Submission Time
2023-03-11 21:00:58+0900
Task
A - Swap Odd and Even
User
Sudhir87
Language
C++ (GCC 9.2.1)
Score
100
Code Size
8314 Byte
Status
AC
Exec Time
19 ms
Memory
3620 KiB
Compile Error
./Main.cpp: In function ‘void solvve()’:
./Main.cpp:211:23: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
211 | for (int i = 0; i < S.size(); i += 2) {
| ~~^~~~~~~~~~
./Main.cpp: In function ‘void FileIO::setIn(str)’:
./Main.cpp:131:31: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
131 | void setIn(str s) {freopen(s.c_str(),"r",stdin);}
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
./Main.cpp: In function ‘void FileIO::setOut(str)’:
./Main.cpp:132:32: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
132 | void setOut(str s) {freopen(s.c_str(),"w",stdout);}
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
100 / 100
Status
AC
Set Name
Test Cases
Sample
All
sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt
Case Name
Status
Exec Time
Memory
sample00.txt
AC
19 ms
3620 KiB
sample01.txt
AC
2 ms
3544 KiB
sample02.txt
AC
1 ms
3500 KiB
testcase00.txt
AC
1 ms
3612 KiB
testcase01.txt
AC
1 ms
3492 KiB
testcase02.txt
AC
2 ms
3496 KiB
testcase03.txt
AC
2 ms
3480 KiB
testcase04.txt
AC
2 ms
3540 KiB