提出 #52718946
ソースコード 拡げる
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/*
このコード、と~おれ!
Be accepted!
∧_∧
(。・ω・。)つ━☆・*。
⊂ ノ ・゜+.
しーJ °。+ *´¨)
.· ´¸.·*´¨) ¸.·*¨)
(¸.·´ (¸.·'* ☆
*/
#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>
#include <array>
#include <chrono>
#include <unordered_set>
//#pragma GCC target("arch=skylake-avx512")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define repeat(i, n, m) for(int i = n; i < (m); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a)
#define printLdb(a) printf("%.50Lf\n", a)
#define printdbd(a) printf("%.16lf\n", a)
#define prints(s) printf("%s\n", s.c_str())
#define all(x) (x).begin(), (x).end()
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d))
using ll = long long;
using ull = unsigned long long;
constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr ll mod = 998244353;
constexpr long double eps = 1e-14;
const long double PI = acosl(-1.0L);
using namespace std;
void scans(string& str) {
char c;
str = "";
scanf("%c", &c);
if (c == '\n')scanf("%c", &c);
while (c != '\n' && c != -1 && c != ' ') {
str += c;
scanf("%c", &c);
}
}
void scanc(char& str) {
char c;
scanf("%c", &c);
if (c == -1)return;
while (c == '\n') {
scanf("%c", &c);
}
str = c;
}
double acot(double x) {
return PI / 2 - atan(x);
}
ll LSB(ll n) { return (n & (-n)); }
template<typename T>
inline T chmin(T& a, const T& b) {
if (a > b)a = b;
return a;
}
template<typename T>
inline T chmax(T& a, const T& b) {
if (a < b)a = b;
return a;
}
//cpp_int
#if __has_include(<boost/multiprecision/cpp_int.hpp>)
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace boost::multiprecision;
#else
using cpp_int = ll;
#endif
//atcoder library
#if __has_include(<atcoder/all>)
#include <atcoder/all>
//using namespace atcoder;
#endif
/*
random_device seed_gen;
mt19937 engine(seed_gen());
uniform_int_distribution dist(1, 100);
*/
/*----------------------------------------------------------------------------------*/
int main() {
string s;
cin >> s;
int n = s.size();
vector<int> v(n);
fill(all(v), -1);
{
vector<int> a;
rep(i, n) {
if (s[i] == '(') {
a.push_back(i);
}
else if (s[i] == ')') {
v[i] = a.back();
v[a.back()] = i;
a.pop_back();
}
}
}
auto f = [&](int l, int r, int flag, auto& f) -> void {
if (flag) {
for (int i = r - 1; i > l; --i) {
if (s[i] == ')') {
f(v[i], i, 0, f);
i = v[i];
}
else {
if(islower(s[i]))s[i] = toupper(s[i]);
else s[i] = tolower(s[i]);
printf("%c", s[i]);
}
}
}
else {
for (int i = l + 1; i < r; ++i) {
if (s[i] == '(') {
f(i, v[i], 1, f);
i = v[i];
}
else {
printf("%c", s[i]);
}
}
}
return;
};
f(-1, n + 1, 0, f);
puts("");
return 0;
}
提出情報
提出日時 |
|
問題 |
F - Transpose |
ユーザ |
null0124 |
言語 |
C++ 23 (gcc 12.2) |
得点 |
0 |
コード長 |
4130 Byte |
結果 |
WA |
実行時間 |
19 ms |
メモリ |
13984 KB |
コンパイルエラー
Main.cpp: In function ‘void scans(std::string&)’:
Main.cpp:77:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
77 | scanf("%c", &c);
| ~~~~~^~~~~~~~~~
Main.cpp:78:28: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
78 | if (c == '\n')scanf("%c", &c);
| ~~~~~^~~~~~~~~~
Main.cpp:81:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
81 | scanf("%c", &c);
| ~~~~~^~~~~~~~~~
Main.cpp: In function ‘void scanc(char&)’:
Main.cpp:87:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
87 | scanf("%c", &c);
| ~~~~~^~~~~~~~~~
Main.cpp:90:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
90 | scanf("%c", &c);
| ~~~~~^~~~~~~~~~
ジャッジ結果
セット名 |
Sample |
All |
得点 / 配点 |
0 / 0 |
0 / 550 |
結果 |
|
|
セット名 |
テストケース |
Sample |
sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
All |
sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt |
ケース名 |
結果 |
実行時間 |
メモリ |
sample_01.txt |
WA |
1 ms |
3564 KB |
sample_02.txt |
WA |
1 ms |
3476 KB |
sample_03.txt |
WA |
1 ms |
3516 KB |
sample_04.txt |
WA |
1 ms |
3540 KB |
test_01.txt |
WA |
1 ms |
3536 KB |
test_02.txt |
WA |
1 ms |
3540 KB |
test_03.txt |
WA |
1 ms |
3492 KB |
test_04.txt |
WA |
15 ms |
9188 KB |
test_05.txt |
WA |
17 ms |
5968 KB |
test_06.txt |
WA |
14 ms |
9708 KB |
test_07.txt |
WA |
17 ms |
8848 KB |
test_08.txt |
WA |
15 ms |
9400 KB |
test_09.txt |
WA |
15 ms |
9112 KB |
test_10.txt |
WA |
16 ms |
5784 KB |
test_11.txt |
WA |
13 ms |
9972 KB |
test_12.txt |
WA |
18 ms |
8208 KB |
test_13.txt |
WA |
17 ms |
8976 KB |
test_14.txt |
WA |
17 ms |
6832 KB |
test_15.txt |
WA |
17 ms |
6492 KB |
test_16.txt |
WA |
17 ms |
7368 KB |
test_17.txt |
WA |
15 ms |
9408 KB |
test_18.txt |
WA |
17 ms |
8900 KB |
test_19.txt |
WA |
17 ms |
8124 KB |
test_20.txt |
WA |
16 ms |
5688 KB |
test_21.txt |
WA |
13 ms |
9968 KB |
test_22.txt |
WA |
19 ms |
6496 KB |
test_23.txt |
WA |
17 ms |
7404 KB |
test_24.txt |
WA |
14 ms |
13916 KB |
test_25.txt |
WA |
13 ms |
13860 KB |
test_26.txt |
WA |
14 ms |
13984 KB |
test_27.txt |
WA |
17 ms |
11272 KB |
test_28.txt |
WA |
18 ms |
10460 KB |
test_29.txt |
WA |
17 ms |
7332 KB |