/ SeriousOJ /

Record Detail

Compile Error

/tmp/cc4UAC23.o: in function `clk(long long, long long)':
foo.cc:(.text+0x49): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/cc4UAC23.o
foo.cc:(.text+0xcb): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc4UAC23.o
/tmp/cc4UAC23.o: in function `solve()':
foo.cc:(.text+0x159): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc4UAC23.o
foo.cc:(.text+0x17b): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/cc4UAC23.o
foo.cc:(.text+0x18a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc4UAC23.o
foo.cc:(.text+0x1ad): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/cc4UAC23.o
foo.cc:(.text+0x1cb): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/cc4UAC23.o
foo.cc:(.text+0x1d4): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc4UAC23.o
foo.cc:(.text+0x1f4): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/cc4UAC23.o
collect2: error: ld returned 1 exit status

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nl << "\n"
#define yes << "YES\n"
#define no << "NO\n"
#define sp " "
ll n, k;
const ll N = 1e7, K = 1e7;
char a[N][K];
ll clk(ll x, ll y)
{
    ll val = 1000000, mn = 0;
    ll left = 0, right = 0, up = 0, down = 0;
 
    for (int i = y - 1; i >= 0; i--)
    {

        if (a[x][i] == '+')
        {
            left++;
        }
        else
        {
          

            break;
        }
    }
    for (int i = y + 1; i < k; i++)
    {
      
        if (a[x][i] == '+')
        {
            right++;
        }
        else
        {
            break;
        }
    }
    for (int i = x - 1; i >= 0; i--)
    {
       
        if (a[i][y] == '+')
        {
            up++;
        }
        else
        {

            break;
        }
    }
   
    for (int i = x+1; i < n; i++)
    {
      
        if (a[i][y] == '+')
        {
            down++;
        }
        else
        {

            break;
        }
    }
     
val = min({left, right, up, down});

    return (4*val)+1;
    //else return 0;
}
void solve()
{

    cin >> n >> k;

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < k; j++)
        {
            cin >> a[i][j];
        }
    }

    ll mx = 0, cnt = 0;
     //clk(2,3);
    for (ll i = 0; i < n; i++)

    {
        for (ll j = 0; j < k; j++)
        {
            if (a[i][j] == '+')
            {
              mx = max(mx, clk(i, j));
            }
            //  cout<<mx;
        }
    }
    cout << mx nl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    ll t;
    cin >> t;
    for (ll i = 0; i < t; i++)
        solve();
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1143 Plus of Pluses
Contest
LU IUJPC : Sylhet Division 2024
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-09 08:51:01
Judged At
2024-12-09 08:51:01
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes