제출 #1331721

#제출 시각아이디문제언어결과실행 시간메모리
1331721win1702Ancient Machine (JOI21_ancient_machine)C++20
70 / 100
43 ms6448 KiB
#include<bits/stdc++.h>
#include "Anna.h"
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define MOD 1000000007
#define FOR(i, l, r) for (int i = l; i <= r; ++i)
#define FOD(i, r, l) for (int i = r; i >= l; i--)
#define fillchar(a, x) memset(a, x, sizeof(a))
#define debug(a,n) {cerr<<#a<<": "; FOR(i,1,n) cerr<<a[i]<<' ';cerr<<'\n';}
#define rep(i, n) for (int i = 0, _n = (n); i < _n; ++i)
#define all(a) (a).begin(),(a).end()
#define BIT(x,i) ((x>>i)&1)
#define MASK(i) (1ll<<(i))
#define FILE ""

void fastip(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    system("color 0A");
    if (fopen(FILE".inp","r")){
        freopen(FILE".inp","r",stdin);
        freopen(FILE".out","w",stdout);
    }
}

const int MAX=100005;
const int div2=(MOD+1)/2;
const ll INF = 1e18;

//void Send(int i){cout<<i;}
void Anna(int n, std::vector<char> s){

    int x=n;
    for(int i=0; i<n; ++i) {
        if(s[i]=='X'){
            x=i;
            break;
        }
    }

    if (x==n){
        FOR(i,1,n) Send(0);
        return;
    }


    for(int i=0; i<x; ++i) Send(0);
    Send(1);
    for(int i=x+1; i<n; ++i){
        if (s[i]=='Z') Send(1);
        else Send(0);
    }

}

//int main(){
//    fastip();
//    int n;
//    vector<char> s;
//    cin>>n;
//    s.resize(n);
//    rep(i,n) cin>>s[i];
//    cout<<n<<'\n';
//    Anna(n,s);
//}



/*
                         ███
                        ▒▒▒
     █████ ███ █████    ████     ████████
    ▒▒███ ▒███▒▒███    ▒▒███    ▒▒███▒▒███
     ▒███ ▒███ ▒███     ▒███     ▒███ ▒███
     ▒▒███████████      ▒███     ▒███ ▒███
      ▒▒████▒████       █████    ████ █████
       ▒▒▒▒ ▒▒▒▒       ▒▒▒▒▒    ▒▒▒▒ ▒▒▒▒▒



        :::       :::          :::::::::::          ::::    :::
       :+:       :+:              :+:              :+:+:   :+:
      +:+       +:+              +:+              :+:+:+  +:+
     +#+  +:+  +#+              +#+              +#+ +:+ +#+
    +#+ +#+#+ +#+              +#+              +#+  +#+#+#
    #+#+# #+#+#               #+#              #+#   #+#+#
    ###   ###            ###########          ###    ####



*/

#include<bits/stdc++.h>
#include "Bruno.h"
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define MOD 1000000007
#define FOR(i, l, r) for (int i = l; i <= r; ++i)
#define FOD(i, r, l) for (int i = r; i >= l; i--)
#define fillchar(a, x) memset(a, x, sizeof(a))
#define debug(a,n) {cerr<<#a<<": "; FOR(i,1,n) cerr<<a[i]<<' ';cerr<<'\n';}
#define rep(i, n) for (int i = 0, _n = (n); i < _n; ++i)
#define all(a) (a).begin(),(a).end()
#define BIT(x,i) ((x>>i)&1)
#define MASK(i) (1ll<<(i))
#define FILE ""

void fastip(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    system("color 0A");
    if (fopen(FILE".inp","r")){
        freopen(FILE".out","r",stdin);
        freopen(FILE".ans","w",stdout);
    }
}

const int MAX=100005;
const int div2=(MOD+1)/2;
const ll INF = 1e18;

//void Remove(int i){cout<<i<<' ';}

void Bruno(int n, int l, std::vector<int> a){

    int x=n;
    rep(i,n){
        if (a[i]==1){
            x=i;
            break;
        }
    }

    if (x==n){
        rep(i,n){
            Remove(i);
        }
        return;
    }

    for(int i=0; i<x; ++i) Remove(i);
    int last=x;
    for(int i=x+1; i<n; ++i){
        if (a[i]==1){
            for(int j=i-1; j>=last+1; --j) Remove(j);
            Remove(i);
            last=i;
        }
    }


    for(int i=last+1; i<n; ++i) Remove(i);
    Remove(x);


}
//
//int main(){
//    fastip();
//    int n;
//    vector<int> s;
//    cin>>n;
//    s.resize(n);
//    rep(i,n){
//        char t;
//        cin>>t;
//        s[i] = t=='0' ? 0 : 1;
//    }
//    Bruno(n,n,s);
//}


/*
                         ███
                        ▒▒▒
     █████ ███ █████    ████     ████████
    ▒▒███ ▒███▒▒███    ▒▒███    ▒▒███▒▒███
     ▒███ ▒███ ▒███     ▒███     ▒███ ▒███
     ▒▒███████████      ▒███     ▒███ ▒███
      ▒▒████▒████       █████    ████ █████
       ▒▒▒▒ ▒▒▒▒       ▒▒▒▒▒    ▒▒▒▒ ▒▒▒▒▒



        :::       :::          :::::::::::          ::::    :::
       :+:       :+:              :+:              :+:+:   :+:
      +:+       +:+              +:+              :+:+:+  +:+
     +#+  +:+  +#+              +#+              +#+ +:+ +#+
    +#+ +#+#+ +#+              +#+              +#+  +#+#+#
    #+#+# #+#+#               #+#              #+#   #+#+#
    ###   ###            ###########          ###    ####



*/


컴파일 시 표준 에러 (stderr) 메시지

# 1번째 컴파일 단계

Anna.cpp: In function 'void fastip()':
Anna.cpp:23:11: warning: ignoring return value of 'int system(const char*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |     system("color 0A");
      |     ~~~~~~^~~~~~~~~~~~
Anna.cpp:25:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         freopen(FILE".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
Anna.cpp:26:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |         freopen(FILE".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

# 2번째 컴파일 단계

Bruno.cpp: In function 'void fastip()':
Bruno.cpp:23:11: warning: ignoring return value of 'int system(const char*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |     system("color 0A");
      |     ~~~~~~^~~~~~~~~~~~
Bruno.cpp:25:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         freopen(FILE".out","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
Bruno.cpp:26:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |         freopen(FILE".ans","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...