답안 #158074

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
158074 2019-10-14T15:57:38 Z muhammad_hokimiyon 입자 가속기 (IZhO11_collider) C++14
0 / 100
4 ms 632 KB
#include <bits/stdc++.h>
#include <ext/rope>
//#pragma GCC optimize("Ofast")

#define fi first
#define se second
#define LL long long

using namespace std;

const int N = 1e6 + 7;
const int mod = 1e9 + 7;
const int B = 317;

int n,m;
string s;
string f;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );
    freopen( "collider.in" , "r" , stdin );
    freopen( "collider.out" , "w" , stdout );

    cin >> n >> m >> s;
    for( int i = 0; i < n; i++ )f.push_back(s[i]);
    for( int i = 1; i <= m; i++ ){
        char c;
        cin >> c;
        if( c == 'a' ){
            int x,y;
            cin >> x >> y;
            x--,y--;
            string t = "";
            t = s[x];
            s.erase( x , 1 );
            s.insert( y , t );
        }
        else{
            int x;
            cin >> x;
            cout << s[x - 1] << "\n";
        }
    }
}

Compilation message

collider.cpp: In function 'int main()':
collider.cpp:25:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen( "collider.in" , "r" , stdin );
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
collider.cpp:26:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen( "collider.out" , "w" , stdout );
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -