Submission #1034315

# Submission time Handle Problem Language Result Execution time Memory
1034315 2024-07-25T12:14:31 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<string, ans> so =  {ans, 130};

    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:21: error: type/value mismatch at argument 2 in template parameter list for 'template<class _T1, class _T2> struct std::pair'
   56 |     pair<string, ans> so =  {ans, 130};
      |                     ^
Anna.cpp:56:21: note:   expected a type, got 'ans'
Anna.cpp:56:23: error: scalar object 'so' requires one element in initializer
   56 |     pair<string, ans> so =  {ans, 130};
      |                       ^~
Anna.cpp: In function 'char sm(char, char)':
Anna.cpp:17:1: warning: control reaches end of non-void function [-Wreturn-type]
   17 | }
      | ^