답안 #918615

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918615 2024-01-30T07:38:40 Z AnarTz Red-blue table (IZhO19_stones) C++14
27 / 100
24 ms 1368 KB
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
    int t;
    
    cin >> t;
    while(t--){
        string s="",o = "+",s1="";
        int n,m,i,c,b;
    cin >> n >> m;
    bool row=true;
    if (m<n)
    {
        c=m-(m/2+1);
        b=n+c;
        row=false;
        
    }else{
        c=n-(n/2+1);
        b=m+c;
        row=true;
    }
cout << b<<endl;
if (row==true)
{
    for (i = 0; i < m; i++)
{
    s=s+o;
    s1=s1+"-";
    
}
for (i = 0; i < n; i++)
    {
        cout << s1<<endl;
        if (i==n/2)
        {
            s1=s;
        }
        
    }
}else{
for (i = 0; i < m; i++)
{
    s=s+o;
    if (s.size()==m/2+1)
    {
        o = "-";
    }
     
}
for (i = 0; i < n; i++)
    {
       cout << s<<endl;
        
    }
}

    }
    return 0;
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:48:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   48 |     if (s.size()==m/2+1)
      |         ~~~~~~~~^~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 5 ms 348 KB Output is correct
4 Incorrect 9 ms 348 KB Wrong answer in test 5 29: 31 < 32
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 1368 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 1368 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 5 ms 348 KB Output is correct
4 Incorrect 9 ms 348 KB Wrong answer in test 5 29: 31 < 32
5 Halted 0 ms 0 KB -