QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#579283 | #9255. Python Program | zhz_vite | Compile Error | / | / | C++23 | 666b | 2024-09-21 11:27:56 | 2024-09-21 11:27:58 |
Judging History
This is the latest submission verdict.
- [2024-09-21 11:27:58]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-09-21 11:27:56]
- Submitted
answer
#include <bits/stdc++.h> using namespace std; #define int long long int I,n,*a[3],*b[3],*c[3],ans; void proc(auto a,auto A) { if (!isalpha(*a)) A[n]=new int(stoi(a));
else A[n]=&I;
} signed main() {
string s; getline(cin,s); for (int _:{0,1}) {
getline(cin,s);
char a[9],b[9],c[9]{};
sscanf(s.c_str(),"%*[\tf]or %*c in range(%[^,)],%[^,)],%[^,)]):",a,b,c);
if (!*c) *c='1';
proc(a,::a);proc(b,::b);proc(c,::c); ++n;
} int F{**c>0?1:-1}; for (I=**a;I*F<**b*F;I+=**c) { int A{*a[1]},B{*b[1]},C{*c[1]},f{1};
if (C<0) A*=-1,B*=-1,C*=-1,f*=-1;
int D{(B-A+C-1)/C};
if (B>A) ans+=(A*2+(D-1)*C)*D/2*f;
} cout<<ans<<endl; return 0;
}
Details
answer.code:1:26: warning: extra tokens at end of #include directive 1 | #include <bits/stdc++.h> using namespace std; #define int long long int I,n,*a[3],*b[3],*c[3],ans; void proc(auto a,auto A) { if (!isalpha(*a)) A[n]=new int(stoi(a)); | ^~~~~ answer.code:3:1: error: expected unqualified-id before ‘else’ 3 | else A[n]=&I; | ^~~~ answer.code:5:1: error: expected declaration before ‘}’ token 5 | } signed main() { | ^ answer.code: In function ‘int main()’: answer.code:7:1: error: ‘string’ was not declared in this scope 7 | string s; getline(cin,s); for (int _:{0,1}) { | ^~~~~~ answer.code:7:1: note: suggested alternatives: In file included from /usr/include/c++/13/string:41, from /usr/include/c++/13/bitset:52, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52, from answer.code:1: /usr/include/c++/13/bits/stringfwd.h:77:33: note: ‘std::string’ 77 | typedef basic_string<char> string; | ^~~~~~ /usr/include/c++/13/string:66:11: note: ‘std::pmr::string’ 66 | using string = basic_string<char>; | ^~~~~~ answer.code:7:19: error: ‘cin’ was not declared in this scope; did you mean ‘std::cin’? 7 | string s; getline(cin,s); for (int _:{0,1}) { | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:146: /usr/include/c++/13/iostream:62:18: note: ‘std::cin’ declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ answer.code:7:23: error: ‘s’ was not declared in this scope 7 | string s; getline(cin,s); for (int _:{0,1}) { | ^ answer.code:17:10: error: ‘::a’ has not been declared 17 | proc(a,::a);proc(b,::b);proc(c,::c); ++n; | ^ answer.code:17:1: error: ‘proc’ was not declared in this scope 17 | proc(a,::a);proc(b,::b);proc(c,::c); ++n; | ^~~~ answer.code:17:22: error: ‘::b’ has not been declared 17 | proc(a,::a);proc(b,::b);proc(c,::c); ++n; | ^ answer.code:17:34: error: ‘::c’ has not been declared 17 | proc(a,::a);proc(b,::b);proc(c,::c); ++n; | ^ answer.code:17:40: error: ‘n’ was not declared in this scope 17 | proc(a,::a);proc(b,::b);proc(c,::c); ++n; | ^ answer.code:19:11: error: ‘c’ was not declared in this scope 19 | } int F{**c>0?1:-1}; for (I=**a;I*F<**b*F;I+=**c) { int A{*a[1]},B{*b[1]},C{*c[1]},f{1}; | ^ answer.code:19:27: error: ‘I’ was not declared in this scope 19 | } int F{**c>0?1:-1}; for (I=**a;I*F<**b*F;I+=**c) { int A{*a[1]},B{*b[1]},C{*c[1]},f{1}; | ^ answer.code:19:31: error: ‘a’ was not declared in this scope 19 | } int F{**c>0?1:-1}; for (I=**a;I*F<**b*F;I+=**c) { int A{*a[1]},B{*b[1]},C{*c[1]},f{1}; | ^ answer.code:19:39: error: ‘b’ was not declared in this scope 19 | } int F{**c>0?1:-1}; for (I=**a;I*F<**b*F;I+=**c) { int A{*a[1]},B{*b[1]},C{*c[1]},f{1}; | ^ answer.code:25:10: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 25 | if (B>A) ans+=(A*2+(D-1)*C)*D/2*f; | ^~~ | abs answer.code:27:3: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’? 27 | } cout<<ans<<endl; return 0; | ^~~~ | std::cout /usr/include/c++/13/iostream:63:18: note: ‘std::cout’ declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ answer.code:27:9: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 27 | } cout<<ans<<endl; return 0; | ^~~ | abs answer.code:27:14: error: ‘endl’ was not declared in this scope; did you mean ‘std::endl’? 27 | } cout<<ans<<endl; return 0; | ^~~~ | std::endl In file included from /usr/include/c++/13/bits/unique_ptr.h:42, from /usr/include/c++/13/memory:78, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:56: /usr/include/c++/13/ostream:735:5: note: ‘std::endl’ declared here 735 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~