Submission #1034314

# Submission time Handle Problem Language Result Execution time Memory
1034314 2024-07-25T12:13:47 Z Hectorungo_18 Tricolor Lights (JOI24_tricolor) C++17
Compilation error
0 ms 0 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;

string abc = "abcdefghijklmnopqrstuvwxyz";

// #define int long long

vector<char> cc = {'R', 'G', 'B', 'R'};


char sm(char a, char b){
    for(int i =0; i < 3; i++){
        if(a ==  cc[i] || b == cc[i]) continue;
        return cc[i];
    }
}


pair<string, int> anna(int n, string s){
    int sm = 0;
    if(n%2 == 1) sm=1;

    int cur = 0, cnt = 1;
    string ans = s;
    while(cur < n){
        for(int i = 0; i < 130; i++){
            if(2*cnt+i >= 130){
                char c=s[cur];
                char d=s[cur+1];
                char f = sm(c, d);
                ans[cur]=ans[cur]=f;
                // cur+=2;
                i++;
            }
            else{
                if(s[cur] != s[cur+1]){
                    ans[cur]=s[cur+1];
                    ans[cur+1]=s[cur];
                }
                else{
                    int pos = 0;
                    for(int i = 0; i < 3; i++){
                        if(cc[i] == s[cur]){
                            pos = i;
                            break;
                        }
                    }
                    ans[cur]=ans[cur+1] = cc[pos+1];
                }
            }
            cur+=2;
            cnt++;
        }
    }
    pair<int, string> so =  {ans, 30};

    return so;

}
#include"Bruno.h"
#include<bits/stdc++.h>

using namespace std;


int n, l;

void init(int N, int L){
    n = N;
    l = L;
}

int bruno(string s){
    int st = -1, en = -1;
    for(int i = 0; i < l-1; i++){
        if(s[i] == s[i+1]){
            st = i;
            for(int j = i; j < l-1; j++){
                if(s[j] == s[j+1]){
                    en = j+1;
                }
                break;
            }
            if(st > 0 && en < n-1) break;
        }
    }
    int lg = en-st;
    lg/=2;
    int ans = l*lg;
    ans+=(en%129);


    return ans;
}


Compilation message

Anna.cpp: In function 'std::pair<std::__cxx11::basic_string<char>, int> anna(int, std::string)':
Anna.cpp:31:33: error: 'sm' cannot be used as a function
   31 |                 char f = sm(c, d);
      |                                 ^
Anna.cpp:56:37: error: could not convert '{ans, 30}' from '<brace-enclosed initializer list>' to 'std::pair<int, std::__cxx11::basic_string<char> >'
   56 |     pair<int, string> so =  {ans, 30};
      |                                     ^
      |                                     |
      |                                     <brace-enclosed initializer list>
Anna.cpp:58:12: error: could not convert 'so' from 'pair<int,std::__cxx11::basic_string<char>>' to 'pair<std::__cxx11::basic_string<char>,int>'
   58 |     return so;
      |            ^~
      |            |
      |            pair<int,std::__cxx11::basic_string<char>>
Anna.cpp: In function 'char sm(char, char)':
Anna.cpp:17:1: warning: control reaches end of non-void function [-Wreturn-type]
   17 | }
      | ^