QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#201369#5153. Delft DistanceSolitaryDream#Compile Error//C++20910b2023-10-05 13:59:162023-10-05 13:59:18

Judging History

你现在查看的是最新测评结果

  • [2023-10-05 13:59:18]
  • 评测
  • [2023-10-05 13:59:16]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,s,t) for(int i=(s),_t=(t); i<=_t; ++i)
typedef double db;
const db pi=acos(-1);
const int N=705;
char a[N][N];
db b[N][N],c[N][N];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(9);
    int n,m;
    cin >> n >> m;
    FOR(i,1,n) cin >> a[i]+1;
    FOR(i,1,m) b[0][i]=10*i-5;
    FOR(i,1,n) {
        FOR(j,0,m) c[i][j]=1e9;
        if(i==1) c[i][0]=5;
        FOR(j,0,m) {
            if(i>1) c[i][j]=min(c[i][j],c[i-1][j]+10);
            if(j) c[i][j]=min(c[i][j],b[i-1][j]+(a[i][j]=='X'?10:5*pi/2));
        }
        FOR(j,1,m) b[i][j]=1e9;
        FOR(j,1,m) {
            if(j>1) b[i][j]=min(b[i][j],b[i][j-1]+10);
            b[i][j]=min(b[i][j],c[i][j-1]+(a[i][j]=='X'?10:5*pi/2));
        }
    }
    cout << min(b[n][m],c[n][m])+5 << '\n';
    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:15:20: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’)
   15 |     FOR(i,1,n) cin >> a[i]+1;
      |                ~~~ ^~ ~~~~~~
      |                |          |
      |                |          char*
      |                std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/istream:168:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)
  168 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/11/istream:168:7: note:   conversion of argument 1 would be ill-formed:
answer.code:15:27: error: cannot bind non-const lvalue reference of type ‘bool&’ to a value of type ‘char*’
   15 |     FOR(i,1,n) cin >> a[i]+1;
      |                       ~~~~^~
In file included from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/istream:172:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match)
  172 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/11/istream:172:7: note:   conversion of argument 1 would be ill-formed:
answer.code:15:27: error: invalid conversion from ‘char*’ to ‘short int’ [-fpermissive]
   15 |     FOR(i,1,n) cin >> a[i]+1;
      |                       ~~~~^~
      |                           |
      |                           char*
answer.code:15:27: error: cannot bind rvalue ‘(short int)(((char*)(& a[i])) + 1)’ to ‘short int&’
In file included from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/istream:175:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)
  175 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/11/istream:175:7: note:   conversion of argument 1 would be ill-formed:
answer.code:15:27: error: invalid conversion from ‘char*’ to ‘short unsigned int’ [-fpermissive]
   15 |     FOR(i,1,n) cin >> a[i]+1;
      |                       ~~~~^~
      |                           |
      |                           char*
answer.code:15:27: error: cannot bind rvalue ‘(short unsigned int)(((char*)(& a[i])) + 1)’ to ‘short unsigned int&’
In file included from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/istream:179:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match)
  179 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/11/istream:179:7: note:   conversion of argument 1 would be ill-formed:
answer.code:15:27: error: invalid conversion from ‘char*’ to ‘int’ [-fpermissive]
   15 |     FOR(i,1,n) cin >> a[i]+1;
      |                       ~~~~^~
      |                           |
      |                           char*
answer.code:15:27: error: cannot bind rvalue ‘(int)(((char*)(& a[i])) + 1)’ to ‘int&’
In file included from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/istream:182:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)
  182 |       operator>>(unsigned i...