제출 #921579

#제출 시각아이디문제언어결과실행 시간메모리
921579vjudge1Collecting Mushrooms (NOI18_collectmushrooms)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define F first #define S second #define ent '\n' #define int long long #define pb push_back typedef long double ld; typedef long long ll; using namespace std; const int maxn = 1e6+12; const int T = 0; const int mod = 1e9+7; int n,m,k,x,y,l,r; int b[maxn],p[maxn],pref[maxn],fact[maxn]; char a[500005][500005]; void solve(){ cin>>n>>m>>k>>x; int ans=0; vector<pair<int,int>>v; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>a[i][j]; if(a[i][j]=='S'){ v.pb({i,j}); } } } map<int,int>mp; if(n==1){ int cnt=0,l=1,r=m; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(j-l > k){ if(a[i][l]=='S')cnt--; l++; } if(a[i][j]=='M'){ mp[j]=cnt; } if(a[i][j]=='S')cnt++; } cnt=0; for(int j=m;j>=1;j--){ if(r-j > k){ if(a[i][r]=='S')cnt--; r--; } if(a[i][j]=='M'){ if(mp[j]+cnt >= x)ans++; } if(a[i][j]=='S')cnt++; } } cout<<ans; return; } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(a[i][j]=='M'){ int cal=0; for(int u=0;u<v.size();u++){ if(max(abs(i-v[u].F) , abs(j-v[u].S)) <= k)cal++; } if(cal>=x)ans++; } } } cout<<ans; } //BEKSULTAN TOP signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t=1; if(T)cin>>t; while(t--)solve(); }

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

mushrooms.cpp: In function 'void solve()':
mushrooms.cpp:65:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |     for(int u=0;u<v.size();u++){
      |                 ~^~~~~~~~~
/tmp/cc1bHvEV.o: in function `solve()':
mushrooms.cpp:(.text+0x289): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc1bHvEV.o
mushrooms.cpp:(.text+0x290): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
mushrooms.cpp:(.text+0x2be): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc1bHvEV.o
mushrooms.cpp:(.text+0x2cd): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/cc1bHvEV.o
mushrooms.cpp:(.text+0x2dc): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/cc1bHvEV.o
mushrooms.cpp:(.text+0x2eb): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc1bHvEV.o
mushrooms.cpp:(.text+0x333): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc1bHvEV.o
mushrooms.cpp:(.text+0x34f): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc1bHvEV.o
mushrooms.cpp:(.text+0x35c): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
mushrooms.cpp:(.text+0x39b): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc1bHvEV.o
mushrooms.cpp:(.text+0x3b3): additional relocation overflows omitted from the output
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status